bash : add autocomplete for tmux.
This commit is contained in:
parent
235c50e81c
commit
941a10081b
10
document/linux/config/bash/module/autocomplete.sh
Normal file
10
document/linux/config/bash/module/autocomplete.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
autocomplete()
|
||||||
|
{
|
||||||
|
local commands="$@"
|
||||||
|
local cur prev
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -47,3 +47,12 @@ tka()
|
||||||
tmux kill-session -t "$session"
|
tmux kill-session -t "$session"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# autocompletes.
|
||||||
|
_ta()
|
||||||
|
{
|
||||||
|
autocomplete "$(tmux list-sessions | sed -e 's/:.*//')"
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _ta ta
|
||||||
|
complete -F _ta tk
|
||||||
|
|
Reference in a new issue