0

My keyboard has z and y switched compared to US keyboards, which makes pressing C-y for completions pretty awkward. I tried adding

imap <expr> <C-z> pumvisible() ? "<C-y>" :"<C-z>"

based on some examples I found but it doesn't seem to work in the popupmenu. How can I map C-z to accept completions?

3
  • 1
    That's working for me. You could have a plugin interfering with the mapping. What happens if you use vim -u NONE (or nvim -u NONE --noplugin)? You could also try inoremap to prevent any potential recursive mappings.
    – Phil R
    Nov 10, 2022 at 17:06
  • Damn, yes, exactly that is the problem. I forgot that coc.nvim switched to their own completion menu and I was using that ...
    – fbence
    Nov 10, 2022 at 22:00
  • 1
    Glad it was an easy fix. Cheers.
    – Phil R
    Nov 11, 2022 at 7:34

1 Answer 1

0

As pointed out in the comments, my issue was with a plugin (coc.nvim). To have both coc.nvim and the built-in completions complete on C-z this is the correct mapping:

inoremap <silent><expr> <C-z> coc#pum#visible() ? coc#pum#confirm() : (pumvisible() ? "\<C-y>" : "\<C-z>")

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.