junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
61.91k stars 2.34k forks source link

Bash completions conflicts with globstar setting #1127

Open barlik opened 6 years ago

barlik commented 6 years ago

Running with bash, when you type:

$ source /usr/share/fzf/shell/completion.bash

$ shopt -u globstar # this allows you to use ** for recursive files/directory expansion 

$ ssh ** <tab>

it correctly uses fzf to show you a list of hosts where you can connect to.

The problem arises when you cancel the search with Ctrl-C. Then bash will try to evaluate ** as a globstar pattern and will traverse the whole tree under your current working directory. If you run it from $HOME it blocks the whole shell for a couple of minutes (depends on your disk usage).

In my opinion, the correct behavior should be not trying to do any more completion after you cancel the fzf. That's the behavior in zsh and fish.

barlik commented 6 years ago

Proposed solution: https://github.com/junegunn/fzf/pull/1128

junegunn commented 6 years ago

You can set FZF_COMPLETION_TRIGGER differently so that it does not conflict with globstar.

FZF_COMPLETION_TRIGGER=?

ssh ?<tab>
barlik commented 6 years ago

This will work, but I would still like to keep the default ** though.

Problem is discussed at https://github.com/junegunn/fzf/pull/1128