coc-pairs
coc-pairs copied to clipboard
Interaction with macros
I was having trouble recording a macro and noticed it appears to be due to the insertion of pairs.
With this extension on running :normal O('')
produces a list that looks something like the following:
(')''')
('')'')
('')
(')''')
('')'')
(')''')
(')''')
(')''')
(')''')
Turning it off produces the sequence you'd expect.
('')
('')
('')
It's no biggie, I can turn it off when recording complex macros or use a different plugin but perhaps you do know why this is happening.
Can't reproduce, it works as expected for me.
I tried switching to jiangmiao/auto-pairs
it fixed the problem. Maybe that helps others too.
There could be some third plugin interacting, or perhaps its a timing issue. The fact I get a few different results for the same set of input keystrokes suggests as much.
If you're not interested in digging deeper, that's fine. I understand you're strapped for time.
It happens on vim8, not neovim.
Interesting. Sounds more and more like performance / racing condition, in my case it's happening with NVIM v0.5.0-nightly-65-ga8f7841
.
Still, using another plugin for pairs is ok too. There are quite a few coc plugins I can't live without 😅 but this one has good alternatives.
Thanks for all the great software!
Same problem here with NVIM v0.5.0-dev+1225-gbbdd00203
Running :normal O('')
will produce randomly: (')''')
, ('')
, '()'''
, (')''')
or ('')'')
.
Really annoying when using macros.
I really like this auto-pairs plugin and I don't want to change... How can I help ? An idea from where the problem comes ?
The issue is still present. Is there a way to disable the plugin temporarily, before running a macro?
In help under coc-actions
:
"toggleExtension" {id} *CocAction('toggleExtension')*
Enable/disable an extension.
So you could run a command, or map toggling it to a keybinding.
I just switched to: https://github.com/jiangmiao/auto-pairs You could also try:
- https://github.com/cohama/lexima.vim
- https://github.com/rstacruz/vim-closer
- https://github.com/Raimondi/delimitMate
Because this issue reminded me, I've recently been frustrated writing macros again and just saw my advice above to switch 😅 .
Another thing one could try is to try and use multi cursor more:
- https://github.com/mg979/vim-visual-multi
coc-pairs is damn smart. jiangmiao/auto-pairs is out for me. When writing Rust, auto-pairs by default won't pair <
, which is a must for type annotations. But when you turn it on, it won't be smart enough not to put <>
when you're writing amount_a < amount_b
. Which, to be fair, is not trivial, but coc-pairs gets this right!
On to the next 😬 .