vim Normal mode commands (Editing) Completion


Completion can be used to match words used in a document. When typing a word, Ctrlp or Ctrln will match previous or next similar words in the document.

This can even be combined with Ctrl-X mode to complete entire lines. For instance type something like:

This is an example sentence.

then go to the next line and begin typing the same sentence:


and then hit Ctrlp which will result in:


Now still in insert mode, hit Ctrlx Ctrlp and then next word will be completed resulting in:

This is

Continue hitting Ctrlx Ctrlp until the entire line is completed.

If you know you want to complete an entire line type this:

This is an example sentence.

then on the next line type:


and hit x Ctrll to complete the line.

If the completion being done is a filename Ctrlx Ctrlf can be used to complete that directory. Type:


then hit Ctrlx Ctrlf and:


will be completed (if at that location). Ctrlx Ctrlf can then be repeatedly used to list the files in the Desktop.