Search code examples
vim

Revert to default completion mode


Using the default vimrc (from $VIMRUNTIME/vimrc_example.vim), CTRL-N and CTRL-P, by default, appear to search my open buffers for completion options.

Which works great for me.

Occasionally, I switch completion modes (using CTRL-X CTRL-F, for example, to start doing filename completion), but I'm flummoxed as to how to switch back to the default. None of the proffered options (like CTRL-X CTRL-N for keyword local completion) seem to work quite the same way.

So how can I revert back to checking my open buffers?


Solution

  • From :h ins-completion:

    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).

    So, basically, you must exit CTRL-X mode to be able to switch to generic completion. This can be done with <C-e> which is the default key for escaping completion, or any other <C-something> that is not already used in that context: <C-ABCGHJMPQRSWZ>.