skywind3000 / vim-auto-popmenu

:sunglasses: Display the Completion Menu Automantically (next AutoComplPop) !!
MIT License
270 stars 37 forks source link

let <CR> confirm select other than create new line #4

Open go0d1uck opened 3 years ago

go0d1uck commented 3 years ago

I use neovim v0.4.4 I want to use to confirm select an item other than creating a new line. so I add the following in my init.vim inoremap pumvisible() ? "\" : "\ but it does not work. But when I do not use skywind3000/vim-auto-popmenu, use the skywind3000/vim-dict only. It works. So how to make it work when I use both plugs above.

Aethelflaed commented 3 years ago

Had the same problem, sadly it's directly in the plugin code, so I had to change it for my need:

diff --git a/plugin/apc.vim b/plugin/apc.vim
index e1a5672..b0002d6 100644
--- a/plugin/apc.vim
+++ b/plugin/apc.vim
@@ -117,7 +117,7 @@ function! s:apc_enable()
                                        \ pumvisible()? "\<c-p>" : "\<s-tab>"
                let b:apc_init_tab = 1
        endif
-       inoremap <silent><buffer><expr> <cr> pumvisible()? "\<c-y>\<cr>" : "\<cr>"
+       inoremap <silent><buffer><expr> <cr> pumvisible()? "\<c-y>" : "\<cr>"
        inoremap <silent><buffer><expr> <bs> <SID>on_backspace()
        let b:apc_init_bs = 1
        let b:apc_init_cr = 1
skywind3000 commented 3 years ago

A new option, g:apc_cr_confirm, is introduced in https://github.com/skywind3000/vim-auto-popmenu/commit/ea64a79b23401f48e95b9bce65ba39c6c020a291 to enable this. try:

let g:apc_cr_confirm = 1