How do I complete words or lines in insert mode?

In insert mode, you can complete words using the CTRL-P and CTRL-N keys. The CTRL-N command searches forward for the next matching keyword. The CTRL-P command searches backwards for the next matching keyword. In insert mode, you can use the CTRL-X CTRL-L command sequence to complete lines that starts with the same characters as in the current line before the cursor. To get the next matching line, press the CTRL-P or CTRL-N keys. There are a lot of other keys/ways available to complete words in insert mode. Vim supports completion of the following items:

    CTRL-X CTRL-L    whole lines

    CTRL-X CTRL-N    keywords in the current file

    CTRL-X CTRL-K    words from a dictionary

    CTRL-X CTRL-T    words from a thesaurus

    CTRL-X CTRL-I    current and included files

    CTRL-X CTRL-]    tags

    CTRL-X CTRL-F    file names

    CTRL-X CTRL-D    macro definitions (also in included files)

    CTRL-X CTRL-V    Vim command line

    CTRL-X CTRL-U    User defined completion

    CTRL-X CTRL-O    Omni completion

User defined completions and omni completions are often set by filetype plugins.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind