fzy
fzy copied to clipboard
Idea: Empty output if no matches
Currently, if I pipe in some lines to fzy, input the garble oSh3ahngah1e and press Enter, this happens:
$ ls | fzy
oSh3ahngah1e
I think I would prefer no output in case there is no match:
$ ls | fzy
I would be easier to use together with a Bash widget I use, that opens a fuzzy find file dialog via rg and fzy. Then I'd rather get no output than incorrect output for the filename.
What do you think?
Hello Asbjørn,
Asbjørn Apeland writes:
Currently, if I pipe in some lines to
fzy, input the garbleoSh3ahngah1eand pressEnter, this happens:$ ls | fzy oSh3ahngah1eI think I would prefer no output in case there is no match:
$ ls | fzyI would be easier to use together with a Bash widget I use, that opens a fuzzy find file dialog via
rgandfzy. Then I'd rather get no output than incorrect output for the filename.What do you think? [...]
I would find it a bit strange because it would limit the fzy output to its piped input instead of giving the freedom to type and output a possible user's input.
I like the dmenu behaviour where:
- `Return' confirms the current selection
- `Shift-Return' confirm the input
E.g.:
% printf "foo\nfooo\nbar\nbaz\n" | dmenu
Typing f' and pressing Return' will confirm foo' (the first selection), like fzy. Typing f' and pressing Shift-Return' will just output f'.
That makes sense to me.
The point I am interested in is, in your example, what happens if I type c?
If I press Return, I would want empty output, as there is no selection (because nothing matches c).
If I press Shift+Return, it might be a good idea to just output c. It sounds like you've got more experience than me there.
What do you think about that?
Asbjørn Apeland writes:
[...] That makes sense to me.
The point I am interested in is, in your example, what happens if I type
c? I would want empty output, as there is no selection (because nothing matchesc).What do you think about that? [...]
In dmenu (both if pressing Return' or if pressing Shift+Return')
the same of what happens in fzy: `c' is printed out.
That is true, that's what happens in dmenu.
I would personally like if it behaved differently. Is that a possibility, or do you think it will not happen?
Good idea. I would accept a PR which added --only-exact (or something similar) but I'd like to keep the default behaviour.
@jhawthorn say:
I would accept a PR which added --only-exact
They forgot to mention the use of fzy, which requires an exact match:
cd /usr/bin
$(ls | fzy)
--only-exact is needed.