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

How do I configure Vim's completion menu to show a popup without auto-selecting the first candidate?

Answer

:set completeopt=menuone,noselect

Explanation

By default, Vim's <C-n> and <C-p> completion can auto-insert the first match, or only show a menu when there are multiple matches. Setting completeopt=menuone,noselect makes the popup always appear (even for a single match) and never pre-select any candidate — giving you full control over what gets inserted.

How it works

completeopt is a comma-separated list of flags that controls the completion pop-up menu:

  • menu — show the popup when there are at least two completions (default).
  • menuone — show the popup even when there is only one completion.
  • noselect — do not automatically select a completion entry; the user must explicitly choose one with <C-n> or <C-p>.
  • noinsert — do not insert any text until a match is explicitly selected.
  • preview — show extra information about the selected completion in the preview window.
  • popup (Vim 9+ / Neovim) — use a floating popup instead of a split for preview info.

Example

With the default settings, typing pri and pressing <C-n> might immediately insert printf. With:

:set completeopt=menuone,noselect

The menu appears but nothing is inserted until you press <C-n> to cycle through options or <C-y> to confirm.

Tips

  • A recommended Neovim config for LSP users: :set completeopt=menu,menuone,noselect.
  • Add noinsert to prevent even partial text from appearing before you confirm a selection.
  • Use <C-y> to accept the currently highlighted completion, <C-e> to abort and restore original text.
  • Inspect your current value with :set completeopt?.

Next

How do I run the same Ex command in every open tab page at once?