vimtricks.wiki Concise Vim tricks, one at a time.

How do I fuzzy-find and open any file in a project without using plugins?

Answer

:set path+=** | :find

Explanation

By adding ** to Vim's path option and using :find, you can search for any file recursively through your project tree with tab completion — no plugins required. This is a powerful built-in alternative to fuzzy finders like fzf for projects where you know part of the filename.

How it works

  • :set path+=** appends ** to the path option, which tells Vim to search all subdirectories recursively when looking for files
  • :find {partial-name}<Tab> searches across all directories on path and offers tab completion on matches
  • :set wildmenu (recommended) shows a visual menu of completions when you press <Tab>

Add these two lines to your vimrc to make it permanent:

set path+=**
set wildmenu

Example

With a project structure like:

src/
  components/
    Button.tsx
    Modal.tsx
  utils/
    format.ts

From anywhere in the project, type:

:find But<Tab>

Vim completes to Button.tsx and opens it. If multiple matches exist, <Tab> cycles through them and wildmenu shows them in a menu.

You can also use glob patterns:

:find *.ts<Tab>

Tips

  • Use :sfind to open in a horizontal split, or :vert sfind for a vertical split
  • Narrow results with a more specific path fragment: :find utils/<Tab> limits matches to the utils/ subtree
  • For very large projects, add set wildignore+=**/node_modules/**,**/.git/** to skip irrelevant directories
  • :find respects suffixesadd — set it to .js,.ts,.py etc. to omit extensions when typing

Next

How do I accept a flagged word as correct for the current session without permanently adding it to my spellfile?