diff --git a/fzf-completion.bash b/fzf-completion.bash index 61797b1..b90206c 100644 --- a/fzf-completion.bash +++ b/fzf-completion.bash @@ -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 diff --git a/test/test_go.rb b/test/test_go.rb index 6aa438b..680edd6 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -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