commit
67f642f5b3
|
|
@ -5,6 +5,32 @@
|
||||||
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
||||||
# Based upon the example at http://paste-it.appspot.com/Pj4mLycDE
|
# Based upon the example at http://paste-it.appspot.com/Pj4mLycDE
|
||||||
|
|
||||||
|
_tmux_expand ()
|
||||||
|
{
|
||||||
|
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\';
|
||||||
|
if [[ "$cur" == \~*/* ]]; then
|
||||||
|
eval cur=$cur;
|
||||||
|
else
|
||||||
|
if [[ "$cur" == \~* ]]; then
|
||||||
|
cur=${cur#\~};
|
||||||
|
COMPREPLY=($( compgen -P '~' -u $cur ));
|
||||||
|
return ${#COMPREPLY[@]};
|
||||||
|
fi;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_tmux_filedir ()
|
||||||
|
{
|
||||||
|
local IFS='
|
||||||
|
';
|
||||||
|
_tmux_expand || return 0;
|
||||||
|
if [ "$1" = -d ]; then
|
||||||
|
COMPREPLY=(${COMPREPLY[@]} $( compgen -d -- $cur ));
|
||||||
|
return 0;
|
||||||
|
fi;
|
||||||
|
COMPREPLY=(${COMPREPLY[@]} $( eval compgen -f -- \"$cur\" ))
|
||||||
|
}
|
||||||
|
|
||||||
function _tmux_complete_client() {
|
function _tmux_complete_client() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local cur="${1}"
|
local cur="${1}"
|
||||||
|
|
@ -40,7 +66,7 @@ _tmux() {
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
if [ ${prev} == -f ]; then
|
if [ ${prev} == -f ]; then
|
||||||
_filedir
|
_tmux_filedir
|
||||||
else
|
else
|
||||||
# Search for the command
|
# Search for the command
|
||||||
local skip_next=0
|
local skip_next=0
|
||||||
|
|
@ -123,7 +149,7 @@ _tmux() {
|
||||||
-t) _tmux_complete_session "${cur}" ;;
|
-t) _tmux_complete_session "${cur}" ;;
|
||||||
*) options="-t" ;;
|
*) options="-t" ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
source-file|source) _filedir ;;
|
source-file|source) _tmux_filedir ;;
|
||||||
has-session|has|kill-session)
|
has-session|has|kill-session)
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
-t) _tmux_complete_session "${cur}" ;;
|
-t) _tmux_complete_session "${cur}" ;;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue