The history of mankind has been marked by countless innovations: the fat burner belt, the meat claw, the Flowbee, Clippy, etc. In rare occurrences, however, a technology comes along that is so revolutionary, a new era is born.
Such a harbinger appeared in the last decade, though it went unnoticed by many: the fuzzy finder. Gone are the days of clicking through directories or wondering if you used hyphens or underscores in that filename. You don’t remember the name of that PDF you named after its obscure French author? Just type the part that comes to mind, and leave out those silly silent letters. The fuzzy finder will fill in the gaps.
There are a few popular fuzzy finders out there, but the most well-known, and my tool of choice, is FZF. FZF offers an abundance of integrations for a command-line shell, and it’s highly configurable (if you want to go down that rabbit hole). Out of the box, it sports basic key commands for file selection and history search. Search results can be pasted into another command, or other commands can be piped into the tool for further filtering. True to its name (FuZzy Finder), searches are fuzzy by default, but an apostrophe (
') will make the search exact, and other symbols alter the behavior in different ways (i.e. ‘!’ for inverse search, ‘^’ and ‘$’ for anchoring the search).
If you use Git on the command line, you’ve probably been frustrated by its
clunky sometimes confusing interface. FZF can integrate with Git to ease the pain, and the author has bundled the common commands into a handy package, complete with a file preview window (which can be toggled on with any other usage).
For those who use the Z-shell, there’s also a shell plugin that replaces the default auto-completion with FZF, which is basically auto-completion2. With the plugin in place, a quick press of the
Tab key will trigger fuzzy completion for any tools with completions configured.
This is all well and good for working in the shell, but oftentimes we don’t want to leave our editor to navigate to a different file. Luckily for Vim users, the author of FZF has released a feature-rich plugin for the editor, and numerous Neovim plugins utilize the base FZF system tool. With it, one can quickly search for files in the nether-est regions of a project, or recursively search through file contents project-wide with lightning speed via integration with ripgrep.
While FZF fits well into my chosen workflow, it isn’t available in every editor. However, in case you weren’t aware, many editors and IDEs offer a built-in fuzzy search of some sort (e.g. ‘#’ at the start of a search in VSCode, ‘*’ at the start of a search in Eclipse’s Quick Switch Editor). It might feel odd at first, but you’ll soon find that, compared to navigating a file explorer or performing an exact match, it saves a ton of time. Prove me wrong!
Down with the hierarchy, embrace the fuzz!