neoclide / coc-pairs

Basic auto pairs extension of coc.nvim
295 stars 14 forks source link

Interaction with macros #49

Open alextes opened 4 years ago

alextes commented 4 years ago

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.

chemzqm commented 4 years ago

Can't reproduce, it works as expected for me.

alextes commented 4 years ago

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.

chemzqm commented 4 years ago

It happens on vim8, not neovim.

alextes commented 4 years ago

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!

gbprod commented 3 years ago

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 ?

JoyceBabu commented 2 years ago

The issue is still present. Is there a way to disable the plugin temporarily, before running a macro?

alextes commented 2 years ago

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:

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:

alextes commented 2 years ago

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 😬 .