vim-surround
vim-surround copied to clipboard
Add Counts for Replacement Arguments
This PR adds support for repeating replacement arguments by beginning the argument with a count.
Examples:
Old text Command New text
hello ysW2* **hello**
hello ysW2] [[hello]]
Repeated delimeters are used by markdown a lot as well as some other languages. Many of the posed use cases of #97 involve repeated delimeters and I think this PR is a more intuitive way to support them.
I think #226 (almost the exact same PR) implements a better count detection (not limited by 0-9)?
There is also a bug where if you do a line selection and then a surround with a multiplier you get something like this:
*
*
I typed VS2* on this line
**
Have to admit I didn’t see that PR.
Limiting to 0-9 was actually intentional. It means you can do, for example, ysiw11
to surround a word with a pair of 1s - I thought it was more likely to want to surround something with a pair of numbers rather than 10+ instances of something. Happy to change it if people disagree though.
Oh, I didn't realize that. I also saw not being able to surround with numbers as a problem. Sounds like a little bit of a hack, but I do prefer your solution.