4

I'd like to switch the behaviour of the <Down> and <C-n> keys when the popup menu (like from omnicompletion) is visible (and <Up>/<C-p> respectively).

The following two mappings work (actually only in neovim; in vim they insert arbitrary lines with single letters on each keystroke):

inoremap <expr> <Down>     pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up>       pumvisible() ? "\<C-p>" : "\<Up>"

The following don't

inoremap <expr> <C-n>      pumvisible() ? "\<Down>" : "\<C-n>"
inoremap <expr> <C-p>      pumvisible() ? "\<Up>" : "\<C-p>"

What am I doing wrong? I tried it with --no-plugin -u NONE to assure that they don't conflict with some other setting or plugin, but that is not the case.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.