How do I open any file in a project by partial name without a fuzzy-finder plugin?
Answer
set path+=**
Explanation
By adding ** to Vim's path option, you enable recursive directory search — which makes :find with tab completion a lightweight project-wide fuzzy finder, no plugins required. Typing :find mod<Tab> will search all subdirectories and present matching files for completion.
How it works
pathcontrols where Vim looks when searching for files with:find,gf, and similar commands- The
**glob means "search recursively through all subdirectories" :findwith tab completion lists all matching files found inpath- After adding
**,:findsearches the current directory tree exhaustively
Add this to your ~/.vimrc or init.vim:
set path+=**
Then optionally suppress the directory listing (it gets noisy in large projects):
set wildignore+=*/node_modules/*,*/.git/*,*/vendor/*
Example
With a project structure like:
project/
src/
models/user.go
models/order.go
cmd/
main.go
From the project root, type:
:find user<Tab>
Vim completes to src/models/user.go and opens it.
Tips
:find *user*<Tab>matches any path containing "user" — use*as a wildcard within the filename:sfindopens the file in a horizontal split,:vfindin a vertical split- Combine with
set wildmenuandset wildmode=list:longestfor a richer tab-completion experience - For very large codebases, limit
**to a subdirectory:set path+=src/**