Regardless of which code completion plugin I use (I tried asyncomplete and YouCompleteMe), when there's a completion pop-up, up and down arrow keys select completion options in it instead of moving the cursor. How do I disable this behavior? For me, tab is enough to cycle through completions.

1 Answer 1


Remap <up> key to close popup menu and move cursor up when popup menu is visible:

inoremap <expr> <up> pumvisible() ? '<c-e><up>' : '<up>'

:h :map-expression
:h complete_CTRL-E
:h pumvisible()

  • 1
    Thanks. I replaced <c-e> with <c-y> to insert the selected completion (my question was probably poorly phrased), works like a charm. <c-e> reverts the line to "what you typed" state regardless of whether there was a selected completion.
    – Grishka
    Dec 6, 2019 at 0:13

Your Answer

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

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