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

How do I enable fuzzy matching for command-line tab completion in Neovim?

Answer

:set wildoptions=fuzzy

Explanation

Enables fuzzy matching for Neovim's command-line tab completion (wildmenu), so you can match any part of a filename, command, or option — not just from the beginning.

How it works

  • wildoptions is a comma-separated option controlling wildmenu behavior
  • The fuzzy value changes completion from prefix-only to subsequence matching: typed characters are matched in order but don't need to be consecutive or at the start
  • Combine with pum to show completions in a popup menu: :set wildoptions=fuzzy,pum
  • Works for filenames, Ex commands, option names, buffer names, and all other completion contexts

Example

Without fuzzy matching, typing :e srcmod<Tab> only shows filenames that literally start with srcmod.

With :set wildoptions=fuzzy,pum:

:set wildoptions=fuzzy,pum

Typing :e srcmod<Tab> now matches src/module/main.go, and typing wld<Tab> on a :set prompt suggests wildoptions, wildmenu, wildmode, and other options containing those letters in sequence.

Tips

  • Combine with :set wildmenu for interactive wildmenu display
  • For Lua-based configs: vim.opt.wildoptions = "fuzzy,pum"
  • Available in Neovim only — not in standard Vim
  • If fuzzy produces too many noisy matches, you can revert with :set wildoptions=pum to keep just the popup

Next

How do I paste a blockwise register without padding lines with trailing spaces in Neovim?