vim Normal mode commands (Editing) Completion


Example

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:

Thi

and then hit Ctrlp which will result in:

This

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:

Thi

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:

~/Deskt

then hit Ctrlx Ctrlf and:

~/Desktop

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