How do I get enhanced tab completion with a visual menu for commands and file paths?
Answer
:set wildmenu wildmode=longest:full,full
Explanation
By default, Vim's command-line tab completion just cycles through options. Enabling wildmenu with a well-tuned wildmode transforms the experience into a visual, interactive menu that shows all available completions — making it far easier to navigate commands, files, buffers, and settings.
How it works
:set wildmenu— enables a horizontal completion menu above the command linewildmode=longest:full,full— a two-stage completion strategy:- First
<Tab>: completes to the longest common substring and shows the full menu - Second
<Tab>: cycles through each option in the menu one by one
- First
This gives you the best of both worlds: smart partial completion on the first press, then visual browsing on subsequent presses.
Example
Typing :color<Tab> with wildmenu enabled shows a horizontal bar with all available colorschemes:
blue darkblue default delek desert elflord evening habamax ...
:colorscheme
Use <Tab> or arrow keys to navigate, then press <CR> to select.
Tips
- Add
:set wildignorecaseto make tab completion case-insensitive - Use
:set wildignore=*.o,*.pyc,*.classto exclude compiled files from file completion - In Neovim, try
wildoptions=pumfor a vertical popup menu instead of the horizontal bar - Other useful
wildmodevalues:list:longestshows all matches as a list and completes the longest common string