kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
3.18k stars 62 forks source link

Dot-repeat without re-input of delimiters? #48

Closed Invertisment closed 2 years ago

Invertisment commented 2 years ago

Hey. I use Spacemacs and surrounding of text is implemented by remembering the inputs as well as the surrounding keys. What this means is that when I click yse$ then it would surround my word like this: $hello$ and then I could repeat it without inputting $ character.

Basic case:

The repeating breaks when I use . to repeat my motion:

[CURSOR]hello
hello

Press yse$. Then go to next line (j0) and then press .. It asks to enter the character $ which I already entered :shrug:

Slightly harder case:

I could then make a macro and I would like to surround the word "world" in $:

[CURSOR]hello world
hello1 world
hello12 world
hello123 world
hello1345 world

Press qqyse$j and then press 4@q. This is the result on Spacemacs:

$hello$ world
$hello1$ world
$hello12$ world
$hello123$ world
$hello1345$ world

And the result on nvim... well it jumps somewhere instead of doing what I expected.

kylechui commented 2 years ago

Hey @Invertisment, I wasn't quite able to reproduce your issue---I tried both yse$ and ysiw$, both of which are able to be dot-repeated without needing to re-enter $. Are you using the latest commit on the main branch?

Edit: Unsure if this is a typo but I think the macro is missing a q: qqyse$jq before 4@q

Invertisment commented 2 years ago

I may probably be using the older version. Maybe my plugin installer didn't upgrade it yet and it's a non-issue. Yes, the macro misses q at the end to stop the recorder.

kylechui commented 2 years ago

If you're using packer.nvim to manage your plugins you can run :PackerUpdate nvim-surround.

Edit: I just re-read and saw that you're using Spacemacs? I'm not quite sure how this fits into things considering that nvim-surround is a plugin for Neovim

Invertisment commented 2 years ago

I use Plug and :PlugUpgrade fixed it. The plug-in works as expected. Repeats work and macros work. Very nice. Thanks for the plug-in!