How do I get a visual tab-completion menu for Vim commands and filenames?
Answer
:set wildmenu
Explanation
The wildmenu option enhances Vim's command-line completion by showing a horizontal menu of matches above the command line when you press <Tab>. Instead of cycling blindly through completions, you see all available options at once and can navigate them visually — transforming command-line tab completion from a guessing game into an interactive experience.
How it works
- Add
:set wildmenuto your vimrc (or run it as an Ex command) - When typing an Ex command, press
<Tab>to trigger completion - A horizontal bar appears above the command line showing all matching options
- Press
<Tab>or<Right>to move to the next match,<S-Tab>or<Left>to move to the previous - Press
<CR>to accept the highlighted match,<Esc>to cancel
This works for command names, filenames, buffer names, settings, help topics, and more — anywhere Vim's command-line completion applies.
Example
Type :color and press <Tab>. The wildmenu shows all available colorschemes:
blue darkblue default desert elflord evening industry koehler morning
Navigate with <Tab> to highlight different schemes and press <CR> to apply one.
Or type :e src/ and press <Tab> to browse files in the src/ directory visually.
Recommended setup
Add these to your vimrc for the best experience:
set wildmenu
set wildmode=longest:full,full
set wildignore=*.o,*.pyc,*.class,*.swp,node_modules/**
wildmode=longest:full,full— first<Tab>completes to the longest common prefix and shows the menu, second<Tab>cycles through full matcheswildignoreexcludes unwanted files from completion results
Tips
- Without
wildmenu, pressing<Tab>in the command line still completes, but it cycles through matches one at a time without a visual display —wildmenuadds the visual bar - The
wildmodeoption controls completion behavior independently ofwildmenu:longestcompletes to the longest common string,fullcycles through matches,listshows all matches in a list - Use
wildoptions=pum(Vim 8.2+ or Neovim) to show completions in a popup menu instead of a horizontal bar — this is more familiar to IDE users wildignorepatterns also affectexpand(),glob(), and commands like:find— they are project-wide exclusion rules- Combine with
:set path+=**and:find filename<Tab>for a powerful fuzzy-file-finder workflow using only built-in Vim features wildmenuworks with:helptoo: type:help wild<Tab>to see all help topics starting withwild- In Neovim,
wildmenuis enabled by default — in Vim you must enable it explicitly