fzf icon indicating copy to clipboard operation
fzf copied to clipboard

Hide search interface in --phony mode

Open Friptick opened this issue 2 years ago • 7 comments

  • [x] I have read through the manual page (man fzf)
  • [ ] I have the latest version of fzf
  • [x] I have searched through the existing issues

Info

  • OS
    • [x] Linux
    • [ ] Mac OS X
    • [ ] Windows
    • [ ] Etc.
  • Shell
    • [x] bash
    • [ ] zsh
    • [ ] fish

Problem / Steps to reproduce

In --phony mode, "fzf becomes a simple selector interface" (says manual). The search prompt becomes useless, but it still accepts text. A bit confusing and ugly.

The hack of --bind='change:clear-query' helps a bit but the surely the best UX is just to disable and hide the whole line when in --phony mode?

Thanks for considering, and for your work on this amazing tool.

Version 0.20.0 Ubuntu LTS

Friptick avatar Jul 23 '22 13:07 Friptick

Related: #2159

So the thing is, I added --phony (now --disabled is the official name) to make change:reload bindings usable. Making fzf a simple, non-searchable menu was not a part of the plan.

  • https://github.com/junegunn/fzf/blob/master/ADVANCED.md#using-fzf-as-interative-ripgrep-launcher

junegunn avatar Aug 03 '22 13:08 junegunn

Fair enough. And sorry for missing the existing issue. Will try the smenu you mentioned there, maybe it's a better fit

The problem is that the zombie search box makes the feature feel incomplete. If non-searchability is really out of scope, then maybe it would be more coherent to just revert the whole feature.

Anyway, it's your project. Go ahead and mark this as wontfix or similar. Thanks.

Friptick avatar Aug 03 '22 18:08 Friptick

If non-searchability is really out of scope, then maybe it would be more coherent to just revert the whole feature.

The option has valid use cases as shown above; search functionality is delegated to an external process started by change:reload binding.

  • See https://github.com/search?q=fzf+disabled+change%3Areload&type=code

And there are creative use cases like this:

printf 'Definition\nSynonym\nAntonym' |
  fzf --reverse --disabled --preview 'if [ -n {q} ]; then echo {} of {q}: ...; else echo Type in a word; fi'

makes the feature feel incomplete

True, especially when the user is not aware of such use cases. But we can't just change the way it works now. I'm going to leave this open and see if we can think of a nice idea to improve it.

junegunn avatar Aug 04 '22 02:08 junegunn

Got round to trying smenu. It doesn't offer custom key bindings. :(

Maybe time to rename your project sfzf - it's too smart! ;)

FYI I'm using it as a very simple CRUD file manager. Having to go thru the Enter key for everything is a deal-breaker.

Friptick avatar Aug 16 '22 12:08 Friptick

@Friptick, you could hide it a bit by adding --no-info and setting the prompt to the empty string --prompt "". It will still take up a line, and show the cursor, but it's a bit less conspicuous.

With --reverse you can use the --prompt "Heading " as a sort of heading. 🙂

Adding --padding 0,1,1,1 makes it almost invisible. 😉

Daghall avatar Feb 27 '23 21:02 Daghall

Ugh, all so hacky! :laughing: Except maybe the second --prompt idea. That one's my usual approach in this situation - pretend to myself that the ugly side effect is in fact a feature :rofl:

More seriously: nice suggestions, thanks.

In this case BTW I decided in the end to to drop --phony mode and just use the tool as God (or @junegunn) intended.

Friptick avatar Feb 27 '23 23:02 Friptick

Yeah, "creative solutions" is kind of my speciality! 😅

In my specific case --layout reverse-list works great. It puts the content at the top, but the (empty) prompt and cursor at the bottom. I also incoporated the --bind='change:clear-query' parameter you mentioned above. So, thanks! 👍

Daghall avatar Feb 28 '23 14:02 Daghall