jiangmiao / auto-pairs

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

hitiing <CR> at {|} doesn't making a new line #327

Closed arpangreat closed 3 years ago

arpangreat commented 3 years ago
when we hit at { } the output should be like this .. {

}

But for me it is not working like that , any suggestions ??

P.S. :- I am using nvim 0.5 with LSP and nvim-compe and completion nvim

LunarWatcher commented 3 years ago

What's the output of :verbose imap <CR>?

arpangreat commented 3 years ago

The bug was with completion-nvim ...

In which completion-nvim set the completion confirm key to which overwrites auto pairs .

The solve was like this

let g:completion_confirm_key = ""
imap <expr> <cr>  pumvisible() ? complete_info()["selected"] != "-1" ?
                 \ "\<Plug>(completion_confirm_completion)"  : "\<c-e>\<CR>" :  "\<CR>"

or in lua config

vim.cmd([[let g:completion_confirm_key = ""]])
vim.cmd([[
imap <expr> <cr>  pumvisible() ? complete_info()["selected"] != "-1" ? "\<Plug>(completion_confirm_completion)"  : "\<c-e>\<CR>" :  "\<CR>"
]])

Thanks for your help 🤗🤗

arpangreat commented 3 years ago

closing this issue.