Autocomplete word

  • Ctrl+p autocomplete word based on matching words in the backward direction
  • Ctrl+n autocomplete word based on matching words in the forward direction

info If more than one word matches, they are displayed using a popup menu. You can use / arrow keys or Ctrl+p/Ctrl+n to move through this list.

info With multiple matches, you'll notice that the first match is automatically inserted and moving through the list doesn't change the text that was inserted. You'll have to press Ctrl+y or Enter key to choose a different completion text. If you were satisfied with the first match, typing any character will make the popup menu disappear and insert whatever character you had typed. Or press Esc to select the first match and go to Normal mode.

Autocomplete line

  • Ctrl+x followed by Ctrl+l autocomplete line based on matching lines in the backward direction

info If more than one line matches, they are displayed using a popup menu. You can use / arrow keys or Ctrl+p/Ctrl+n to move through this list. You can also use Ctrl+l to move up the list.

Autocomplete assist

  • Ctrl+e cancels autocomplete
    • you'll retain the text you had typed before invoking autocomplete
  • Ctrl+y or Enter change the autocompletion text to the currently selected item from the popup menu

info See :h ins-completion for more details and other autocomplete features.

Video demo:


info See also my Vim Reference Guide and curated list of resources for Vim.