Closed danymat closed 3 years ago
nore
means "not recursive". When you declare the binding as not being recursive, and you just use (
, that means you output the literal character. You either need to change it to inremap ô <C-r>=AutoPairsInsert('(')
, or drop the nore
and make it a recursive imap ô (
(and equivalent for any other keybinds you may have, regardless of which option)
I switched to imap
and it fixed the issue, thank you for your help @LunarWatcher
@LunarWatcher Hello. Due to the incompromising black code style which forces to use double quotes in Python, I want to remap single quotes to double quotes in Vim to ease the burden of having to use double quotes. However imap ' "
seems not work with the auto-pair plugin. In other words, when I input '
, I still get ''
rather than ""
. What should I do? I would appreciate your reply.
You'll have to remove '
from g:AutoPairs
. This should work: autocmd FileType python let b:AutoPairs = AutoPairsDefine({}, ["'"])
. The second argument removes the pair with the associated open character (if it exists). I think this is stock jiangmiao at least. If not, my fork supports it
Auto-pairs isn't designed to completely change the pair type, so you'll have to disable auto-pairs' own completion for '
for your mapping to take precedence. Alternatively, if your map is a buffer map, you can try to find an autocmd that runs after the one auto-pairs uses (I don't remember which jiangmaio's version uses anymore) and do your mapping then. That would override auto-pairs' mapping, but again, your map has to be a buffer map for that to work. Auto-pairs exclusively uses buffer maps, which don't interact with global maps (making a global map will not overwrite a buffer map, and vice versa).
Not sure if the converted "
will trigger auto-pairs for ", but I think it will, seeing as you use a recursive map.
Hello everyone, I tried using auto-pair and it works well, but when want to use a remap I created for
(
and{
, it doesn't work.These are the remaps I created: