vim-easycomplete icon indicating copy to clipboard operation
vim-easycomplete copied to clipboard

auto-pairs <CR> overrides selection's action

Open jayli opened this issue 4 months ago • 8 comments

https://github.com/jiangmiao/auto-pairs/issues/380

jayli avatar Aug 16 '25 05:08 jayli

Very random behavior observed... (I) output of :verbose imap <cr> (I am in main.c) i <CR> * <Plug>EasycompleteCR
Last set from ~/.config/nvim/plugged/vim-easycomplete/autoload/easycomplete.vim line 207

(II) output of :verbose imap <cr> (I am in header include/shader.h) i <CR> &@easycomplete#TypeEnterWithPUM()<SNR>22_AutoPairsReturn
Last set from ~/.config/nvim/plugin/auto-pairs.vim line 664
i <CR> * <Plug>EasycompleteCR
Last set from ~/.config/nvim/plugged/vim-easycomplete/autoload/easycomplete.vim line 207

I think @easycomplete#TypeEnterWithPUM() above should not be there.

NOW, when i start fresh session of nvim without opening any file except for main.c (III) output of :verbose imap <cr> i <CR> &@<CR><SNR>22_AutoPairsReturn
Last set from ~/.config/nvim/plugin/auto-pairs.vim line 664
i <CR> * <Plug>EasycompleteCR
Last set from ~/.config/nvim/plugged/vim-easycomplete/autoload/easycomplete.vim line 207

Now this works perfect, but if I go to definition of function (it directly to declaration unless you have the respective C file indexed... clangd issue... this was not the case before... it used to retrieve definitions just fine using compile_flags.txt now everythings broken... whoops... coming back to topic) for example use_shader() in shader.h, we reset back to case (II)

saiprasadhakki avatar Aug 16 '25 16:08 saiprasadhakki

as of now, the working commit is: 1db4a17ee62c1947b898131c4facd199cf07a185

output of :verbose imap <cr> : i <CR> &@<SNR>22_AutoPairsOldCRWrapper73<SNR>22_AutoPairsReturn
Last set from ~/.config/nvim/plugin/auto-pairs.vim line 664
i <CR> * easycomplete#TypeEnterWithPUM()
Last set from ~/.config/nvim/plugged/vim-easycomplete/plugin/easycomplete.vim line 595

saiprasadhakki avatar Aug 16 '25 17:08 saiprasadhakki

I don't know the reason for the constant conflict. I just unmap the <cr> mapping to disable <cr> of auto-pair when vim-easycomplete is running.

jayli avatar Aug 18 '25 10:08 jayli

Okay, then maybe the problem is when vim-easycomplete is running, so does that correspond to how vim-easycomplete interacts with vim's builtin completion? or when we use a keybind to trigger easycomplete e.g. <Tab> ? because this time while testing on 670da88c63458824e2aa5d392d3a55bfa0ecc001 there was no mapping to auto-pairs.

(it somehow even broke Telescope fzf)

I shall get back with more info on this (that is, the exact commit where the mapping problem begins)

saiprasadhakki avatar Aug 19 '25 08:08 saiprasadhakki

With the last update, are there any error messages?

jayli avatar Aug 19 '25 16:08 jayli

No conflict with config or error messages upon launching nvim as such.

Any particular string you want me to look for in nvim logs ??

saiprasadhakki avatar Aug 20 '25 10:08 saiprasadhakki

There should be no. Thank you for your feedback.

jayli avatar Aug 21 '25 02:08 jayli

(it somehow even broke Telescope fzf)

I shall get back with more info on this (that is, the exact commit where the mapping problem begins)

Hi, turns out it unmaps everything binded to <CR> when using other plugins, switches back to i <CR> * <Plug>EasycompleteCR when not.

function! easycomplete#TypeEnterWithPUM()
  if !(g:easycomplete_pum_noselect)
    let l:item = easycomplete#GetCursordItem()
  else
    let l:item = easycomplete#GetCompletedItem()
  endif

in above code can't we map <CR> back to AutoPairs and return in the else statement? that is, when no item is selected use simple <CR> and not use EasycompleteCR.

saiprasadhakki avatar Nov 01 '25 13:11 saiprasadhakki