mirror of
https://github.com/junegunn/fzf.git
synced 2026-02-18 07:54:26 +08:00
Fix #135 - Directory completion to append /
This commit is contained in:
@@ -88,7 +88,7 @@ _fzf_path_completion() {
|
||||
[ "$dir" = './' ] && dir=''
|
||||
tput sc
|
||||
matches=$(find -L "$dir"* $1 2> /dev/null | fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do
|
||||
printf '%q ' "$item"
|
||||
printf "%q$3 " "$item"
|
||||
done)
|
||||
matches=${matches% }
|
||||
if [ -n "$matches" ]; then
|
||||
@@ -103,6 +103,7 @@ _fzf_path_completion() {
|
||||
[[ "$dir" =~ /$ ]] || dir="$dir"/
|
||||
done
|
||||
else
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
_fzf_handle_dynamic_completion "$cmd" "$@"
|
||||
@@ -136,19 +137,19 @@ _fzf_list_completion() {
|
||||
_fzf_all_completion() {
|
||||
_fzf_path_completion \
|
||||
"-name .git -prune -o -name .svn -prune -o -type d -print -o -type f -print -o -type l -print" \
|
||||
"-m" "$@"
|
||||
"-m" "" "$@"
|
||||
}
|
||||
|
||||
_fzf_file_completion() {
|
||||
_fzf_path_completion \
|
||||
"-name .git -prune -o -name .svn -prune -o -type f -print -o -type l -print" \
|
||||
"-m" "$@"
|
||||
"-m" "" "$@"
|
||||
}
|
||||
|
||||
_fzf_dir_completion() {
|
||||
_fzf_path_completion \
|
||||
"-name .git -prune -o -name .svn -prune -o -type d -print" \
|
||||
"" "$@"
|
||||
"" "/" "$@"
|
||||
}
|
||||
|
||||
_fzf_kill_completion() {
|
||||
@@ -219,7 +220,7 @@ fi
|
||||
|
||||
# Directory
|
||||
for cmd in $d_cmds; do
|
||||
complete -F _fzf_dir_completion -o default -o bashdefault $cmd
|
||||
complete -F _fzf_dir_completion -o nospace -o default -o bashdefault $cmd
|
||||
done
|
||||
|
||||
# File
|
||||
|
||||
Reference in New Issue
Block a user