How do I show documentation for the selected completion item in a popup window?
Answer
set completeopt+=popup
Explanation
Adding popup to completeopt makes Vim display extra information — such as function signatures or documentation — for the currently highlighted completion item in a floating popup window, rather than opening a split preview window.
How it works
When the completion menu is open and you move through candidates, Vim checks whether the completion source provides an info field for the item. If it does, that text is shown in a small popup to the side of the menu.
popup— show info in a floating popup window (Vim 8.1.1882+ and Neovim 0.10+)preview— the older alternative; opens a split window at the top
To enable it alongside other common options:
set completeopt=menu,menuone,noselect,popup
Example
With set omnifunc=syntaxcomplete#Complete in a Python file, pressing <C-x><C-o> opens a completion menu. Selecting os.path.join shows its signature and documentation in a compact popup next to the menu — no split window needed.
Tips
- To also suppress the split window being opened for preview, use
noselect,popuptogether - The popup uses the
CompleteInfohighlight group for styling - If an item has no
info, the popup does not appear — this is expected - Requires Vim 8.1.1882+ or Neovim 0.10+; use
previewas a fallback for older versions - LSP clients (like the built-in Neovim LSP) populate the info field automatically, making this very useful in LSP workflows