vim-auto-popmenu icon indicating copy to clipboard operation
vim-auto-popmenu copied to clipboard

let <CR> confirm select other than create new line

Open go0d1uck opened this issue 4 years ago • 2 comments

I use neovim v0.4.4 I want to use <CR> to confirm select an item other than creating a new line. so I add the following in my init.vim inoremap <CR> pumvisible() ? "<C-y>" : "<CR> 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.

go0d1uck avatar Feb 25 '21 02:02 go0d1uck

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

Aethelflaed avatar Mar 10 '21 16:03 Aethelflaed

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

skywind3000 avatar Mar 11 '21 00:03 skywind3000