Word Completion (Ctrl-N / Ctrl-P)

Vim has had autocomplete since 1996.

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…
Ctrl-NPop the completion menu
Ctrl-NCycle forward through matches
Ctrl-PCycle back
Ctrl-YAccept the highlighted match
Ctrl-ECancel β€” 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.).

β–Ά Try this in the simulator

Watch

See also: The {key:Ctrl-X} Sub-Completions