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
wildoptionsis a comma-separated option controlling wildmenu behavior- The
fuzzyvalue 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
pumto 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 wildmenufor 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=pumto keep just the popup