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

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 line
  • wildmode=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

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 wildignorecase to make tab completion case-insensitive
  • Use :set wildignore=*.o,*.pyc,*.class to exclude compiled files from file completion
  • In Neovim, try wildoptions=pum for a vertical popup menu instead of the horizontal bar
  • Other useful wildmode values: list:longest shows all matches as a list and completes the longest common string

Next

How do I ignore whitespace changes when using Vim's diff mode?