For questions about the several commands to complete part of a keyword or line that has been typed.
In insert-mode and replace-mode, there are several commands to complete part of a keyword or line that has been typed. This is useful if you are using complicated keywords (e.g., function names with capitals and underscores).
Completion can be done for:
- whole lines
|i_CTRL-X_CTRL-L|
- keywords in the current file
|i_CTRL-X_CTRL-N|
- keywords in dictionary
|i_CTRL-X_CTRL-K|
- keywords in thesaurus, thesaurus-style
|i_CTRL-X_CTRL-T|
- keywords in the current and included files
|i_CTRL-X_CTRL-I|
- tags
|i_CTRL-X_CTRL-]|
- file names
|i_CTRL-X_CTRL-F|
- definitions or macros
|i_CTRL-X_CTRL-D|
- Vim command-line
|i_CTRL-X_CTRL-V|
- user defined completion
|i_CTRL-X_CTRL-U|
- omni completion
|i_CTRL-X_CTRL-O|
- spell-checking suggestions
|i_CTRL-X_s|
- keywords in 'complete'
|i_CTRL-N|
All these (except 2) are done in CTRL-X
mode. This is a sub-mode of Insert
and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid
CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), and CTRL-P (previous).
When completion is active you can use CTRL-E to stop it and go back to the originally typed text. The CTRL-E will not be inserted.
When the popup menu is displayed you can use CTRL-Y to stop completion and accept the currently selected entry. The CTRL-Y is not inserted. Typing a space, Enter, or some other unprintable character will leave completion mode and insert that typed character.
Full documentation: vimdoc ins-completion