jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.11k stars 373 forks source link

conflict with coc.nvim auto-completion in some situation #361

Closed wanaiqing closed 1 year ago

wanaiqing commented 1 year ago

Auto-completion was messed up in certain situation, tested with minimal configuration in docker.

.vimrc vimrc.txt

screen record

https://user-images.githubusercontent.com/20230818/216559910-8af712e2-1702-4927-94ac-f958abcca031.mp4

LunarWatcher commented 1 year ago

What's the output of

imap <cr>
imap <SNR>1234_AutoPairsOldCRWrapper1234

where 1234 is replaced with the numbers you see in imap <cr>?

wanaiqing commented 1 year ago

What's the output of

imap <cr>
imap <SNR>1234_AutoPairsOldCRWrapper1234

where 1234 is replaced with the numbers you see in imap <cr>?

the output of "imap \": i &@16_AutoPairsOldCRWrapper7316_AutoPairsReturn i * coc#pum#visible() ? coc#_select_confirm() : "\u\"

the output of "imap \16_AutoPairsOldCRWrapper73": i 16_AutoPairsOldCRWrapper73 &@coc#pum#visible() ? coc#_select_confirm() : "\

u\"
LunarWatcher commented 1 year ago

Finally reproduced it. Looks like both SNRs are invoked, which sounds like the most plausible explanation.

You'll have to

let g:AutoPairsMapCR = 0
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR><C-r>=AutoPairsReturn()\<cr>"
wanaiqing commented 1 year ago

Finally reproduced it. Looks like both SNRs are invoked, which sounds like the most plausible explanation.

You'll have to


let g:AutoPairsMapCR = 0

inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR><C-r>=AutoPairsReturn()\<cr>"

Great! It's gone.

wanaiqing commented 1 year ago

Thanks. @LunarWatcher

dr0bz commented 1 year ago

@LunarWatcher Thank you very much. I had this issue as well.