fzf: More menu-like options, with fuzzy finding

I said a long time ago that find is one of the greatest creations for computers, probably since the invention of electricity.

Junegunn Choi’s fzf might make you think hard about it though.

2014-08-05-6m47421-fzf

That’s a slooow animated gif, isn’t it? I’m experimenting with stop-motion animation.😆

In much the same vein as sentaku and percol, fzf accepts a list — by default, the list of files in the current directory tree — and allows selection by way of fuzzy finding. As you can see there, not only does fzf pluck out entries that contain “an” exactly, but also retains options for longer, less-strict matches.

Making a selection returns the value to STDOUT, making fzf another candidate for the oft-mentioned slmenu gimmick. Again, though, like percol, you might have to arrange that list of programs as a text file.

Then again, maybe not.

ls /usr/bin | fzf

Oooh, that’s tempting fate right there.😮

fzf is a lot less visual than percol or sentaku, but approaches the concept — picking out a selection from a large list — from a pattern matching perspective. It would take a little more command-line prowess to make percol act in the same way.

fzf is fast, clean, colorful, useful, intuitive, easy to use and doesn’t require a complex set of commands to employ. It can return multiple selections, and it plays well with other Unixy tools. So as Junegunn suggests, something like

vim $(fzf)

is viable. (I should probably mention that I tried to shunt the results of find into fzf, but there were some snags.) It might also play nicely with something that cues music files. Think about that one for a little bit.

I’ll leave you alone to meddle with fzf for a bit. Perhaps even more than slmenu or sentaku or percol, fzf has the potential to change the way you work at the command line. And for that … I think fzf is eligible for a rare K.Mandla gold star:⭐ Enjoy!😉

6 thoughts on “fzf: More menu-like options, with fuzzy finding

  1. Theodore

    A comment for both percol and fzf: they are both cool but too much… general-purpose. Which make them both, in my view of things, obsoleted by patching slmenu… At the moment I’d like a fselect ( http://devel.ringlet.net/misc/fselect/ ) with colors. I think I’ll fork it or make some ill shell script based on the output of ls –group-directories-first –classify😀

    1. K.Mandla Post author

      I’ll have to take a closer look at fselect. I don’t see it in the Arch or Debian repos. Does it behave like slmenu?

      1. Theodore

        Nope, it’s the same thing (a menu) but it’s aimed to different purposes. Slmenu reads the stdin you feed to it, fselect takes as argument(s) those you’d feed to ls. It also works cumbersomely, while slmenu it’s straightforward: as far as I used it (after modifying it, because the tarball crashes at runtime) you have to push space to select or deselect the file you wish from a list, shaped like ls -l –color=never, and then exit with Enter: if you’ve selected some files, it spits on stdout those files in a classic newline separated list.
        I think you’d find it only on the link I provided to you, don’t know why. And you have to #include everywhere strftime(5) is used, in order to avoid segfail.

  2. Pingback: tmenu: Just one step away | Inconsolation

  3. Pingback: Bonus: 2014 in review | Inconsolation

  4. Pingback: fselect: Pulled from the brink | Inconsolation

Comments are closed.