Tip 7Finding Files Using Fuzzy Path Matching

You can rely on Vim’s built-in :edit {filepath} command for opening any file on your file system, but specifying a filepath can require a lot of typing. Using a fuzzy finder can usually produce the same result with far fewer keystrokes.

Preparation

Vim users are spoiled for choice when it comes to fuzzy finder plugins. In this tip, you’ll be using Junegunn Choi’s excellent fzf tool.[20] This consists of two parts: a standalone fzf program, which you can run in your shell, and a Vim plugin, which depends upon the external program.

Installing and Configuring fzf

You can install the fzf repository to your bundle package like this:

=> $ cd $VIMCONFIG/pack/bundle/start
=> $ git clone https://github.com/junegunn/fzf ...

Get Modern Vim now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.