2

When I type in Vim, I get autocomplete from coc.

To accept one of the items on the list I need to press Ctrly.

I would like to change this button to Enter but I cannot figure out how to do so. I do not mind if it's in lua.

Thanks

2
  • I use the html tag: <kbd>Ctrl</kbd> it is verbous but it avoid the confusion induced by + for the beginner I was not so long ago ;-) Sep 28, 2022 at 16:31
  • 1
    Thats really cool. I didnt know that. Thanks :)
    – Vinn
    Sep 28, 2022 at 16:32

1 Answer 1

2

From the coc page (and my .vimrc file)

" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
3
  • To be clear, in your example the <c-r> ctrl+r accepts an entry?
    – Vinn
    Sep 28, 2022 at 16:32
  • That make <Enter> accept the entry on the version of Coc I use (the latest) Sep 28, 2022 at 16:34
  • 1
    You are my favorate person right now!! Thanks.
    – Vinn
    Sep 28, 2022 at 17: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.