Use <cr> to confirm completion
yufengwang opened this issue · comments
I want tu use <cr>
to confirm completion, but with map as below, things seems not working.
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
I had issues with that mapping as well. However, I don't have that mapping anymore anyway because I found I didn't need it. Once the completion window is open, I use <tab>
to go to next entry (or <ctrl>n
for next and <ctrl>p
for previous). Each time you highlight a completion option, it will autofill that value. So once I have the one I need, I just start typing my next characters of code. Pressing <enter>
didn't do anything for me other than add an extra keystroke.
Quick image of what I mean below:
Once I highlight the function I want from the menu, just typing (
to start adding function args is the quickest way to keep going. No need for <enter>
, even if the mapping works.