jiangmiao/auto-pairs

AutoPairsJump() to <>

sergiza opened this issue ยท 11 comments

I've defined some custom pairs but AutoPairsJump() doesn't seem to work with them.

Any way to make it at least work with <> ?

No. The values are hard-coded. You'd need to manually edit the code to make it work.

My fork supports this though. It auto-generates the regex based on all (active) pairs

Thanks! I'll try it out.

@LunarWatcher just one question if you don't mind, is there any quick way to remove all default mappings in your plugin?
I just want to map the AutoPairsJump(), AutoPairsShortcutToggle and that's it, don't want anything else mapped.

Quick? No. You'd have to manually disable them (and I don't have any copypasta handy for it). There aren't that many though, and they're all in https://github.com/LunarWatcher/auto-pairs/blob/18fc5b659c4b0b1b3898f2b513e96bf90045be10/autoload/autopairs/Keybinds.vim#L202.

Could probably add a variable that disables default initialisation of keybind variables, but won't get around to that until tonight

@LunarWatcher I had inoremap <C-l> <Esc>:call AutoPairsJump()<CR>a mapped, as a way to call AutoPairsJump only from insert mode and also customize a bit the behavior. Is it not possible to call AutoPairsJump() in your fork?

Also in your fork, AutoPairsJump() jumps ( |here| ), while in jiangmiao's version it jumps ()|here|. Wouldn't be an issue if I could :call AutoPairsJump() and just insert a <Right> at the end.

Sorry for bothering here in the comments of this issue, but I don't know if these nitpicks would make a good bug report / feature suggestion.

I had inoremap <C-l> <Esc>:call AutoPairsJump()<CR>a mapped, as a way to call AutoPairsJump only from insert mode and also customize a bit the behavior. Is it not possible to call AutoPairsJump() in your fork?

It is, but the function has been moved to an autoload script. You'll want inoremap <C-l> <Esc>:call autopairs#AutoPairsJump()<CR>a instead. It's otherwise identical. Most function calls have the autopairs# prefix in my fork, because most of them are in an autoload file. That's one of the incompatible changes between the two, but it makes for some significant QOL improvements with config files, particularly when setting g:AutoPairs (because the function calls can be placed in the .vimrc without an autocmd that's invoked after plugin load, and the files are loaded on-demand)

Also in your fork, AutoPairsJump() jumps ( |here| ), while in jiangmiao's version it jumps ()|here|. Wouldn't be an issue if I could :call AutoPairsJump() and just insert a <Right> at the end.

It should be identical. The only difference in my fork is the regex generation, but it can produce a regex identical to Jiangmiao's regex. Are you sure you're not comparing a manual call to your map? The a at the end is probably why you end up after rather than before

Recorded a couple of gifs to show you the difference, with no configuration on either side.

jiangmiao :
jiangmiao

@LunarWatcher :
LunarWatcher

How do you trigger it? The map you showed earlier?

Yeah, the only thing I configured in those examples is just let g:AutoPairsShortcutJump = '<c-l>']]. Maybe it's an issue with my mapping that i never realized ๐Ÿ˜…

Oh, I see. Might've accidentally changed the map somehow. I'll take a look later

Found the cause. Looks like there were some migration issues when event ignoring was added. There was an excess command that didn't have a at the end, and the first command was broken. Not entirely sure how I missed this, but whatever.

Fixed it and added regression tests, so should be good now