summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2022-08-22 22:29:51 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2022-08-22 22:29:51 +0900
commit6532b3e655c765c79feaa5936d8e686d943c1e4e (patch)
tree5e53ded0d4e7fcaac7436ec0f17c0fd12af52bad /shell
parentc1c355160d95fbf17237b6d02deb2535da16c7ec (diff)
[completion] Remove extra trailing slash on directory completion
Fix #2931
Diffstat (limited to 'shell')
-rw-r--r--shell/completion.bash2
-rw-r--r--shell/completion.zsh3
2 files changed, 3 insertions, 2 deletions
diff --git a/shell/completion.bash b/shell/completion.bash
index 69b88165..c7d73818 100644
--- a/shell/completion.bash
+++ b/shell/completion.bash
@@ -181,7 +181,7 @@ __fzf_generic_path_completion() {
[[ -z "$dir" ]] && dir='.'
[[ "$dir" != "/" ]] && dir="${dir/%\//}"
matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
- printf "%q$3 " "$item"
+ printf "%q " "${item%$3}$3"
done)
matches=${matches% }
[[ -z "$3" ]] && [[ "$__fzf_nospace_commands" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
diff --git a/shell/completion.zsh b/shell/completion.zsh
index bd478e55..417d03c0 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -146,7 +146,8 @@ __fzf_generic_path_completion() {
[ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" | while read item; do
- echo -n "${(q)item}$suffix "
+ item="${item%$suffix}$suffix"
+ echo -n "${(q)item} "
done)
matches=${matches% }
if [ -n "$matches" ]; then