For questions about the several commands to complete part of a keyword or line that has been typed.

In and , 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:

  1. whole lines |i_CTRL-X_CTRL-L|
  2. keywords in the current file |i_CTRL-X_CTRL-N|
  3. keywords in |i_CTRL-X_CTRL-K|
  4. keywords in , thesaurus-style |i_CTRL-X_CTRL-T|
  5. keywords in the current and included files |i_CTRL-X_CTRL-I|
  6. |i_CTRL-X_CTRL-]|
  7. file names |i_CTRL-X_CTRL-F|
  8. definitions or s |i_CTRL-X_CTRL-D|
  9. Vim |i_CTRL-X_CTRL-V|
  10. user defined completion |i_CTRL-X_CTRL-U|
  11. omni completion |i_CTRL-X_CTRL-O|
  12. suggestions |i_CTRL-X_s|
  13. 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

history | excerpt history