0

Using: NeoVim

I would like to remap j/k in Insert completion mode:

  • tab starts autocompletion (done, used :help ins-complete example)
  • j/k navigate results like <C-n>/<C-p>

If I understand correctly the Insert completion mode simply shares rebinds with the normal Insert mode, so there's no inoremap equivalent (i.e. pnoremap for comPlete). So is there some way of doing this?

I would prefer not to use a plugin. A best case solution would not break my existing inoremap jk <esc> binding, but I would also be interested in solutions that break that.

1 Answer 1

2

Something like the following should work and still allow your jk to function:

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

Your Answer

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

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