There seem to be three main competitors here:
https://github.com/wincent/Command-T
First project I used.
Pro:
- Works reasonably reliably
Con:
- Requires compilation
- Requires language support in Vim itself
- Need to manaually regenerate, this can take a while
https://github.com/ctrlpvim/ctrlp.vim
Pro:
- configurable ignore list
- no compilation or language support required
- reasonably speedy
Con:
- bad matching algorithm
https://github.com/junegunn/fzf
Pro:
- general "unixy" solution, can fuzzy find any list of strings
- plugins for Vim and Tmux
- will also fuzzy find files for you on the command line
- matching performance as strong as Command T
- file list not cached, no manual reload
Con:
- some inital setup required, not as bad as command T
brew install fzf
git clone https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
The install script
- gets a binary version of
fzf
- symlinks the
fzf
binary where it's expected
It then optionally does all or none of:
- adds the plugin to your ~/.vimrc
- adds keybindings for your shell (by adding a line to ~/.foorc)
You can compile a binary yourself and then use as much or as little of the magic
as you desire. The Vim plugin is available separately as junegunn/fzf.vim
. All
the plugin cares about is that it has access to an executable fzf
.
By default FZF matches returns all files in the directory tree. You can
configure this behaviour by setting an environment variable. Since I already
have ack
setup with exlcude lists, I piggy back FZF on this.
With a modern version of ack
, you can use:
export FZF_DEFAULT_COMMAND='ack -f'
It lists every file ack would have searched, if it was actually searching. Otherwise you're stuck with ack -g ""
.
You can also just pipe to fzf
on stdin, and it will use that instead of
executing a default command.
You should also bind map <leader>t :FZF<CR>
in your ~/.vimrc while you're at
it.
The two most useful things I find outside of vim are:
**<TAB>
: fuzzy find on the command line
Ctrl-R
: fuzzy find command history