fzf
is an incredibly useful bit of software, if someone shows you how to use it. There’s a lot more to it than just fuzzy-switching directories and fuzzy-searching you shell history – it also comes with a preview pane that updates on every keystroke. Try
|
|
and typing something to see how it works. ({q}
is the q
uery you type in at the bottom of the screen.)
When you start using this preview pane, you might start to use it as the primary use of fzf
for various purposes. It’s really helpful! But how do you actually get the preview pane to print what it sees to stdout?
Turns out there’s another fzf
flag called --bind
, which lets you do this:
Now when you hit Enter, the preview pane will be returned to stdout, and abort
will exit you out of the program. Very handy for things like adding interactive modes to CLI programs.