🔺
187 Words

Vim/Neovim Fuzzy File Finder

In vscode when you hit Ctrl+p it opens a fuzzy finder that allows you to find and open files without needing the full path.

Using vim as an ide this is one of the features I miss the most.

I used the cloudhead/neovim-fuzzy plugin installed with vim-plug. If I was going to do this again I would try the vim-scripts/FuzzyFinder plugin instead.

Setting up cloudhead/neovim-fuzzy

Place this in your init.vim file to add the plugin to vim-plug.

1
2
3
4
call plug#begin()
" Fuzzy finder
Plug 'cloudhead/neovim-fuzzy'
call plug#end()

I also needed to install some packages required by the plugin. And I believe it expects git to be installed.

1
sudo apt install fzy ripgrep
1
brew install fzy ripgrep

As of writting this there is an issue that requires a workaround. issues/50

1
2
3
4
"Neovim-fuzzy settings
let g:fuzzy_rootcmds = [ 
	\ ["git", "rev-parse", "--show-toplevel"],
	\ ]

Then do a :PlugInstall as usual.

And then you will want to map the fuzzy finder to a keybinding.

1
2
3
nnoremap <Leader>p :FuzzyOpen<CR>
" or
nnoremap <C-p> :FuzzyOpen<CR>