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

How do I limit the height of Vim's insert-mode completion popup menu?

Answer

:set pumheight=10

Explanation

By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates. Setting pumheight caps the number of visible rows in the menu, keeping it compact and out of the way regardless of how many completions are available.

How it works

  • :set pumheight={n} limits the popup menu to at most {n} visible rows
  • pumheight=0 (the default) means no limit — the menu grows as large as needed
  • Scrolling indicators appear when the list is taller than pumheight, so you can still access all candidates with <C-n> / <C-p>
  • The related option pumwidth sets the minimum width of the popup
  • Changes take effect immediately, even while the popup is open

Example

In your vimrc:

set pumheight=12

Now the completion menu shows at most 12 items at a time. In a file with 200 completion candidates (e.g., a large codebase), the menu stays manageable.

Tips

  • A pumheight of 8–15 is a common preference — large enough to browse options, small enough not to obscure the code underneath
  • Pair with set completeopt=menu,menuone,noselect so the menu appears without auto-selecting the first item, giving you full control
  • set pumblend=10 adds a subtle transparency to the popup (Neovim only) — useful in colorful themes to see what is behind the menu
  • If you use a completion plugin (nvim-cmp, coc.nvim), it often has its own popup height setting that overrides or supplements pumheight

Next

How do I run a search and replace only within a visually selected region?