Closed anasouardini closed 4 months ago
-q, --query=STR Start the finder with the given query
-f, --filter=STR Filter mode. Do not start interactive finder.
--filter
(or -f
) should be followed by a query string. In -f +s
case, +s
is recognized as the query string. i.e. equivalent to --filter=+s
. So you should remove --query
and do fzf -1 -0 +s --filter="r"
or fzf -1 -0 -f "r" +s
fzf +s --filter="r"
or fzf -f "r" +s
instead.
I missed to mention that -1
and -0
are not compatible with --filter
but with --query
.
-1, --select-1
If there is only one match for the initial query (--query), do not start interactive finder and automatically select the only match
-0, --exit-0
If there is no match for the initial query (--query), do not start interactive finder and exit immediately
So you should try something like fzf -f "r" +s | head -1
instead.
Hmm, I just realized there is a critical bug in the streaming filter mode (i.e. --no-sort --filter=something
) since fzf 0.47.0.
Thank you, that satisfies my question.
Checklist
man fzf
)Output of
fzf --version
0.38.0 (debian)
OS
Shell
Problem / Steps to reproduce
I want to use
fzf
in a non-interactive mode, and from theman
page it seems like the options-f
and+s
are going to makefzf
act likegrep
which what I want, but when I use those options,fzf
just exits.My goal is to select one option even if the query is still vague (doesn't filter down to only one option). If I'm not mistaken this command should work just find:
fzf -1 -0 -f +s --query="r"
I suspect the option
-f
to be causing the issue: