bash : add autocomplete for tmux.

This commit is contained in:
Dmitry Voronin 2023-10-23 00:24:36 +03:00
parent 235c50e81c
commit 941a10081b
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,10 @@
autocomplete()
{
local commands="$@"
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
return 0
}

View file

@ -47,3 +47,12 @@ tka()
tmux kill-session -t "$session"
done
}
# autocompletes.
_ta()
{
autocomplete "$(tmux list-sessions | sed -e 's/:.*//')"
}
complete -F _ta ta
complete -F _ta tk