tmux : support multiple args for tk.
This commit is contained in:
parent
0436da5934
commit
fac60dda30
|
@ -43,15 +43,15 @@ tn()
|
|||
# kill specified session or default one.
|
||||
tk()
|
||||
{
|
||||
local name="$1"
|
||||
|
||||
# set default name.
|
||||
if [[ "$name" = "" ]]; then
|
||||
name="main"
|
||||
if [[ "${1}" = "" ]]; then
|
||||
1="main"
|
||||
fi
|
||||
|
||||
# call tmux.
|
||||
tmux kill-session -t "$name"
|
||||
for name in "$@"; do
|
||||
tmux kill-session -t "${name}"
|
||||
done
|
||||
}
|
||||
|
||||
# kill all sessions.
|
||||
|
@ -65,15 +65,21 @@ tka()
|
|||
}
|
||||
|
||||
# autocompletes.
|
||||
_tmux_sessions()
|
||||
_complete_tmux_session()
|
||||
{
|
||||
_autocomplete_first "$(tmux list-sessions 2> /dev/null | sed -e 's/:.*//')"
|
||||
}
|
||||
|
||||
_tmux_names()
|
||||
_complete_tmux_sessions()
|
||||
{
|
||||
_autocomplete "$(tmux list-sessions 2> /dev/null | sed -e 's/:.*//')"
|
||||
}
|
||||
|
||||
_complete_tmux_name()
|
||||
{
|
||||
_autocomplete_first "${PWD##*/}" $(ls --classify | grep /$ | sed -e 's/\/$//')
|
||||
}
|
||||
|
||||
complete -F _tmux_sessions ta tk
|
||||
complete -o nosort -F _tmux_names tr tn
|
||||
complete -F _complete_tmux_session ta
|
||||
complete -F _complete_tmux_sessions tk
|
||||
complete -o nosort -F _complete_tmux_name tr tn
|
||||
|
|
Reference in a new issue