diff options
author | Kobe Lipkens <kobelipkens@gmail.com> | 2015-12-28 21:11:04 +0100 |
---|---|---|
committer | Kobe Lipkens <kobelipkens@gmail.com> | 2015-12-28 21:11:04 +0100 |
commit | 6208fc9cfd96c4e64dd1cc03b947be6ee6a393c8 (patch) | |
tree | 086c791e50f63c13c97a9068e7fe2e6a777f539d /shell | |
parent | e1dd798482490db6c43158d418973aa6e61659b7 (diff) |
Fix autocompletion for absolute paths
Diffstat (limited to 'shell')
-rw-r--r-- | shell/completion.bash | 3 | ||||
-rw-r--r-- | shell/completion.zsh | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/shell/completion.bash b/shell/completion.bash index 191091d0..ef3a965c 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -110,7 +110,8 @@ __fzf_generic_path_completion() { if [ -z "$dir" -o -d "$dir" ]; then leftover=${base/#"$dir"} leftover=${leftover/#\/} - [ -z "$dir" ] && dir='.' || dir="${dir/%\//}" + [ -z "$dir" ] && dir='.' + [ "$dir" != "/" ] && dir="${dir/%\//}" tput sc matches=$(\find -L "$dir" $1 -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | $fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do printf "%q$3 " "$item" diff --git a/shell/completion.zsh b/shell/completion.zsh index 1b2a7dd2..6e2d9321 100644 --- a/shell/completion.zsh +++ b/shell/completion.zsh @@ -30,7 +30,8 @@ __fzf_generic_path_completion() { if [ -z "$dir" -o -d ${~dir} ]; then leftover=${base/#"$dir"} leftover=${leftover/#\/} - [ -z "$dir" ] && dir='.' || dir="${dir/%\//}" + [ -z "$dir" ] && dir='.' + [ "$dir" != "/" ] && dir="${dir/%\//}" dir=${~dir} matches=$(\find -L "$dir" ${=find_opts} -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q "$leftover" | while read item; do printf "%q$suffix " "$item" |