The Wildmenu
wildmenu, wildmode, wildoptions โ making Tab at the : prompt actually pleasant.
Three options shape Tab completion at the : prompt.wildmenuturns on the visual menu;wildmodepicks the cycling strategy;wildoptionstweaks behavior. Together they turn : into a tolerable file picker.
By default, vintage Vim's Tab completion at the : prompt just replaces what you typed with the first match, with no preview of the alternatives. Tab again cycles. It works, but you're guessing. Three options turn this into a real menu.
| Option | What it does |
|---|---|
wildmenu |
Turns on the visual completion menu โ a list of candidates above the : line that you can walk through with Tab/Shift-Tab (or Ctrl-N/Ctrl-P). |
wildmode |
How Tab behaves: complete to longest common prefix first, cycle, list-only, or some combination. |
wildoptions |
Extra wildmenu features. The most useful value is pum (Neovim 0.9+): show completions as a popup menu over the buffer rather than a single-line strip. |
The recipe everyone copies
These four lines in your config buy you a competent file picker without any plugin:
set wildmenu
set wildmode=longest:full,full
set wildoptions+=pum
set wildignorecase
Read it as: show the menu, on the first Tab complete to the longest unambiguous prefix and open the menu, on the second Tab cycle through entries; render the menu as a popup (Neovim only); be case-insensitive for filename matching.
A worked example
Suppose your cwd contains README.md, render_html.py, render_markdown.py, and requirements.txt. With the recipe above:
| Keystrokes | What you see |
|---|---|
:e rTab |
Command-line becomes :e re; the menu lists every matching file: README.md, render_html.py, render_markdown.py, requirements.txt. |
| Tab | Command-line becomes :e README.md; first menu entry highlighted. |
| Tab | Advances to :e render_html.py. |
| Tab | :e render_markdown.py. |
| nTab | Type n to extend the prefix to ren, then Tab again โ menu narrows to just the two render_* files. |
| Enter | Opens the highlighted file. |
See also: Command-Line Completion, File Operations, Setting Options (:set)