summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-12-29 08:22:52 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-12-29 08:22:52 +0900
commita9aa263d3a8cffd77f8eab8dabfe841d6318611f (patch)
tree086c791e50f63c13c97a9068e7fe2e6a777f539d
parente1dd798482490db6c43158d418973aa6e61659b7 (diff)
parent6208fc9cfd96c4e64dd1cc03b947be6ee6a393c8 (diff)
Merge pull request #458 from frizinak/fix-autocomplete-abs
Fix auto-completion for `/`
-rw-r--r--shell/completion.bash3
-rw-r--r--shell/completion.zsh3
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"