• I have some key binding A^X^O (in insert mode) to omni-complete something
  • I have some key binding B^Ogj to temporarily do something in normal mode (in this case, move down a display line)

However, if I press ^A^B, the second ^O conflicts with the first ^O and removes the omnicompletion.

How can I modify ^A so that it exits the ^X mode?

For normal typing I'd just use <esc>gj but this is in a binding.

I did read help for i_CTRL-X and ins-completion, but I can't find any dedicated key. popupmenu-keys (^Y) only work when there's a popupmenu, in this case there isn't because there's only one completion entry.

I did find some workaround (posted as an answer below), but I may have missed some dedicated method to do it. (like ^Y in completion mode with popup)

For context, I'm typing </^X^O to omni-complete HTML tags.

2 Answers 2


The second ^O actually functions like ^N when omnicompletion is active. From :h i^x^o, we see that

CTRL-O or CTRL-N : Use the next match. This match replaces the previous one.

To exit omnicompletion, we need a key that "does nothing", as suggested by your answer. One such combination is ^gU (This actually prevents a break in the undo sequence when used with <left>,<right>).

Thus the following mappings will work:

inoremap ^A ^X^O^GU
inoremap ^B ^Ogj

(where ^X is entered by pressing CTRL-VCTRL-X)


These are some workaround:

  • <space><backspace>. Works (space is guaranteed to exit the completion mode), but doesn't seem very nice.
  • <left><right>. Should work, as long as the expansion does not expand to nothing.
  • <c-g><c-g>. This is no-op by now, but I think the behavior is not documented.
    • The above, and map <c-g><c-g> to <nop>. Does not work.
  • <c-\><c-o>i.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.