knazarov.com/content/posts/why_i_like_fzf/note.md

1.1 KiB

X-Date: 2021-09-12T14:58:27Z X-Note-Id: 53071f6d-980c-4111-b2b0-571e8c3aeddf Subject: Why I like fzf X-Slug: why_i_like_fzf

FZF is my new go-to tool. I've known for a long time that it exists, it just didn't occur to me to go and study it in more detail.

Here's what it can do apart from the obvious filtering:

  • Run a script that receives text you enter and provides a list of results to choose from
  • Show a sidebar with detailed preview that you can also generate with a script

This makes it possible to build all sorts of things, including for example something like Alfred. Alfred works by having a few "prefix" commands that branch out to different behaviors. The "define" command will look up a dictionary definition of the word. If you type "define auspicious", you'll get a preview with the definition of "auspicious".

You can build the same with fzf with a dozen lines of shell! You just need to parse the input and extract the prefix command from it and output a list of options to stdout.

I have a prototype of this is fzf and it works really well! I'll be sharing it in the coming weeks.