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
- keywords in the current file
- keywords in dictionary
- keywords in thesaurus, thesaurus-style
- keywords in the current and included files
- file names
- definitions or macros
- Vim command-line
- user defined completion
- omni completion
- spell-checking suggestions
- keywords in 'complete'
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