Description
Is your feature request related to a problem? Please describe.
I'd like to select a query, whether single or multiple selections.
Currently, for single selection, the <tab>
key is bound to select a query, and this key binding is hard coded.
For multiple selection, there are no key bindings to select a query, and <tab>
is used to toggle selection.
I'd like to use same key (e.g. ctrl-y
) to select a query for both single and multiple selections.
Describe the solution you'd like
Remove SuggestionType::SingleRecommendation
and make SuggestionType::SingleSelection
(--prevent-extra
option) as default.
Allow to forward --bind
options to fzf
.
User can select a query by binding print-query
action to arbitrary keys.
Example:
config.yaml
finder:
overrides_var: --reverse --height 16 --cycle --bind 'ctry-y:print-query'
cheatseet
% sample
# sample
echo <word>
$ word: echo -e 'one\ntwo\nthree'
# multiple
echo <words>
$ words: echo -e 'one\ntwo\nthree' --- --multi --map "tr '\n' ' '"
# prevent extra
echo <exact_word>
$ exact_word: echo -e 'one\ntwo\nthree' --- --bind 'ctrl-y:ignore'
Example of print-query
actions in fzf
are following.
echo -e 'one\ntwo\nthree' | fzf --bind 'ctrl-y:print-query'
echo -e 'one\ntwo\nthree' | fzf --multi --bind 'ctrl-y:print-query'
echo -e 'one\ntwo\nthree' | fzf --bind 'ctrl-y:print-query' --bind 'ctrl-y:ignore' # second binding invalidates first binding
I confirmed with fzf version 0.55.0.
Describe alternatives you've considered
In fact, selecting query can be achieved in the current implementation by setting the following
config.yaml
finder:
overrides_var: --reverse --height 16 --cycle
cheatseet
% sample
# sample
echo <word>
$ word: echo -e 'one\ntwo\nthree' --- --prevent-extra --fzf-overrides '--reverse --height 16 --cycle --bind "ctrl-y:print-query"'
# multiple
echo <words>
$ words: echo -e 'one\ntwo\nthree' --- --multi --map "tr '\n' ' '" --fzf-overrides '--reverse --height 16 --cycle --bind "ctrl-y:print-query"'
# prevent extra
echo <exact_word>
$ exact_word: echo -e 'one\ntwo\nthree' --- --prevent-extra
This approach is annoying because it requires the --prevent-extra
and --fzf-overrides
options.
Additional context