Vim Fuzzy Find Files Without a Plugin
Skip the plugins, vim can fuzzy find through your project just fine. And now you can simply type part of the file name. You even get tab completion and selection menu
Skip the plugins, vim can fuzzy find through your project just fine.
There are many great plugins that add a fuzzy finder in vim and for some cases, they're better suited, eg: extremely large projects. But for much of the time, adding this bit to you vimrc
will get you most of the way there.
set path=$PWD/** " enable fuzzy finding in the vim command line
set wildmenu " enable fuzzy menu
Setting the path to $PWD/**
will recursively search all directories below the current one. And now you can simply :find
and type part of the file name, you even get tab completion and selection menu!
The wildmenu will show multiple matches and can be configured to ignore certain files. Below is an example of my vimrc
set path=$PWD/** " enable fuzzy finding in the vim command line
set wildmenu " enable fuzzy menu
set wildignore+=**/.git/**,**/__pycache__/**,**/venv/**,**/node_modules/**,**/dist/**,**/build/**,*.o,*.pyc,*.swp
Notably, the above wildignore
will hide __*
files, compiled c/c++ files and git repo files among others.
Warning
If your in a project with many files (1000+), the fuzzy finder will lag, it isn't async and the UI will lockup until it's found the file(s). In this case, I've used fzf along with the corresponding vim plugin.