Word Completion (Ctrl-N / Ctrl-P)

Type a few letters; let Vim finish the word.

Keys: Ctrl-N, Ctrl-P, Ctrl-E, Ctrl-Y

Ctrl-N and Ctrl-P trigger keyword completion from the current and other buffers. Once a menu is up, Ctrl-N/Ctrl-P walk the suggestions; Ctrl-E cancels; Ctrl-Y accepts.

Word Completion

Type a partial word, then Ctrl-N (next) or Ctrl-P (previous) to autocomplete from words already in scope. Vim has had this since the mid-90s β€” long before IDE autocomplete was standard.

Workflow
KeyNote
texStart typing…
{key:Ctrl-N}Pop the completion menu
{key:Ctrl-N}Cycle forward through matches
{key:Ctrl-P}Cycle back
{key:Ctrl-Y}Accept the highlighted match
{key:Ctrl-E}Cancel β€” keep what you typed

Worked example β€” Ctrl-N

Word completion from buffer.

Step 1 Β·
insert.completion
Step 2 Β· Ctrl-N Β· Ctrl-N β€” matched 'con' to the only word starting with it.
Ctrl-N β€” matched 'con' to the only word starting with it.

Ctrl-N searches forward through known words; Ctrl-P backward. Ctrl-X opens the sub-completion menu (filenames, lines, etc.).

Watch

See also: The Ctrl-X Sub-Completions