fzf icon indicating copy to clipboard operation
fzf copied to clipboard

Only tab complete after no match?

Open esran opened this issue 6 years ago • 2 comments

Would it be possible to have the fzf tab completion only kick in after a tab fails to do any completion? Often I want to tab complete something I know is a partial match that I am going to add a * to so I can do something on a (sub)set of files.

e.g.

> ls
test_1.txt
test_2.txt
results_1.txt
results_2.txt

> rm res<tab>
  rm results_
  rm results_*

At the moment, that first tab immediately goes into fzf mode, making it difficult to partially complete a file name. It also feels that more naturally matches existing tab completion modes which tend to only offer you a list when you hit tab and there's no common partial solution.

esran avatar Jul 18 '19 15:07 esran

I understand what you're trying to say, and I think the behaviour you're requesting is entirely possible and legitimate. I honestly don't use the tab completion with fzf, and currently don't have the time to look into it, so I'm going to leave it here with a help-wanted tag for the moment. Happy to look into any PR which allows toggling this behaviour via a flag.

jethrokuan avatar Jul 18 '19 17:07 jethrokuan

Although not exactly what was requested, set -U FZF_COMPLETE_OPTS --exact seems to get pretty close to doing this. If there was a --prefix option, that would be even better.

Edit: Turns out set -U FZF_COMPLETE_OPTS --exact --tiebreak=begin --select-1 might be the best of all options.

amir20 avatar Dec 18 '20 04:12 amir20