Finding a Needle in a Haystack with FZF

Noah Settersten
Finding a Needle in a Haystack with FZF

A Fast and Customizable Fuzzy Finder for Vim

Trying to Find Specific Items in Your Codebase

As a developer, I’m often bouncing between numerous files, looking for a specific item in a massive codebase, or trying to remember that arcane command I ran once months ago.

There are a handful of fuzzy find tools, either from builtin editor features or via the shell, but they often suffer from unfortunate limitations. Whether slow performance or having cache results get out of date, they often require accepting tradeoffs.

FZF - Quickly Find What You Need in Vim

Enter FZF, a modern fuzzy finder written in Go that is not only incredibly fast but also very customizable.

With shell bindings and the ability to tie into Vim, it’s sped up our workflow at Headway quite a bit. Searching for a file by name in a project is nearly instantaneous, and it’s easy to pull up a command in your shell history with a few keystrokes.

Here’s how I’m using it in my environment:

Installing and Managing FZF for Vim

I manage my Vim plugins using vim-plug which is a simple manager that installs plugins in parallel. It also has the ability to run post-install hooks to manage external libraries. Using it to install and manage FZF is straightforward:

In your .vimrc:

Install fzf vim plug

Running :PlugInstall in Vim will then copy FZF into the .fzf directory in your home folder and then run its post-install script to configure the native executable. FZF comes with basic Vim bindings out of the box, but I like to make a few changes:

In your .vimrc:

manage fzf vim tips

This maps the FZF search to Ctrl-F, and sets up hotkeys for opening splits in Vim similar to others I’m used to using. With only those few lines, searching for any file within the root directory becomes a breeze.

install manage fzf

When vim-plug installs FZF, it also makes it available for use on your PATH as well. With a few entries in Zsh’s config, we can tie command history search into FZF:

In your .zshrc:

zsh history search

This sets up Zsh’s history search on Ctrl-R and then runs the FZF zshell script to configure FZF for it.

zsh history search gif

Customize FZF - Ignoring Specific Directories

Now that we have our fuzzy find in place, there’s a good chance we’ll want to exclude certain entries from the results. Library dependencies, the .git directory, and others can be easily left out by setting the FZF_DEFAULT_COMMAND environment variable:

In your .zshrc:

fzf ignore directories

Add any other directories you want ignored with -o -name directory_name -prune.


Simple tools can make all the difference in being productive and covering ground quickly. I’ve found FZF to be a huge asset towards that goal, and it’s worth the investment to get a handle on it.


The Weekly Manifest

Receive the latest design, development, and startup articles to stay updated!


Inquiry Sent!

Thanks so much for your interest in working with us, and for your time to fill out the form. We're passionate about what we do and would love the opportunity to create a successful solution for you.

Expect to hear back from us within the next 3 business days.

Work With Us

We can take on any type of project, but we don’t work with everyone. We only partner with clients that align with our business values, honestly benefit from our expertise, and embrace the systems we build in.

Fill out the form below to start a conversation see if you’re the right fit for us.

What type of project would you like to partner with us on?