mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 12:55:17 +00:00
Fix #135 - Directory completion to append /
This commit is contained in:
parent
d4b41c5e03
commit
79c147ed78
@ -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
|
||||
|
@ -517,7 +517,9 @@ class TestBash < TestBase
|
||||
tmux.send_keys 55
|
||||
tmux.until { |lines| lines[-2].start_with? ' 1/' }
|
||||
tmux.send_keys :Enter
|
||||
tmux.until { |lines| lines[-1] == 'cd /tmp/fzf-test/d55' }
|
||||
tmux.until { |lines| lines[-1] == 'cd /tmp/fzf-test/d55/' }
|
||||
tmux.send_keys :xx
|
||||
tmux.until { |lines| lines[-1] == 'cd /tmp/fzf-test/d55/xx' }
|
||||
end
|
||||
|
||||
def test_process_completion
|
||||
|
Loading…
Reference in New Issue
Block a user