Closed echoonly closed 2 years ago
I'm not sure if there's any way to fix this here. skywind3000/vim-auto-popmenu forcibly maps <cr>
. Not really sure why it fails intermittently, but when it does fail, if you :verbose imap <cr>
, the keybind probably doesn't contain anything related to auto-pairs. Auto-pairs can't do its job if its functions aren't called.
There is some compatibility on our end, but if other plugins screw with the auto-pairs mappings after they're loaded... there's nothing that can be done. This is also an unfortunate downside of Vim not allowing several keybinds of the same type on the same key, particularly on central keys that a number of plugins actually use. cr
and space being two of said keys does make the mapping a challenge. Might be more appropriate to raise an issue with skywind3000/vim-auto-popmenu and ask for a compatible CR mapping instead.
... quick digression, but I both see and don't see Vim's idea. You avoid conflicts, i.e. a plugin mapping, say, y
, and both of them inserting their own characters, but Vim isn't multithreaded. Needing to manually create compound keybinds creates a lot of interesting compatibility issues between plugins, and a number of them could've been avoided if Vim supported multiple keybinds on the same key.
Anyway, like I said, I don't think there's anything auto-pairs can do here. If it's being steamrolled by vim-auto-popmenu, it's their fault.
Thank you for the quick and exhaustive reply, I now figure out the reason for the failure, it is really not auto-pair's fault, auto-pair can not do anything, I will try to raise an issue with vim-auto-popmenu, thanks again.
When I used auto-pair with skywind3000/vim-auto-popmenu, the 'Insert new indented line after Return' features of auto-pair were no longer available. I hope to see results:
but I got this:
I use vim-plug to manage my plugin, If put the auto-pair in front of vim-auto-popmenu, like this:
This feature will always be unavailable, but when reverse the order:
This feature works fine when open vim, but if reload buffer with
:e
, or switch branch withgit co
, the feature fails again.