4

I'm using deoplete plugin for auto completion. In Vim, default keybinding for up and down when popup appears is CtrlN / CtrlP. I want to change to CtrlJ / CtrlK for same behavior with CtrlP plugin.

How can I change this. thanks

1 Answer 1

7

You can't "directly" map keys in the pop-up menu, you'll have to use expression mappings and the pumvisible() function to check if the popup menu is visible.

inoremap <expr> <C-j> pumvisible() ? "\<C-n>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<C-p>" : "\<C-k>"

If the popup menu is visible <C-j> is mapped to <C-n> to make it go to the next entry. If the menu isn't visible <C-j> is mapped to <C-j>.

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.