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
    Commented Dec 6, 2019 at 0:13
  • for those who use lunarvim: github.com/LunarVim/LunarVim/discussions/4367
    – Crispy13
    Commented May 14 at 4:10

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.