This has been bothering me for ages, but maybe I'm just doing something wrong.
I have vim-repeat installed and it dutifully repeats commands, but it doesn't repeat the entire command. Say I do ysiw" to surround a single word with double quotes, and now I move the cursor to a different word and hit ., I would just expect that word to be surrounded with double quotes. Instead, I need to strike " again.
So usually this goes ysiw"j."j."j."j."j."j."j.", etc... It would be so much faster if I could just do ysiw"j.j.j.j.j.j.j.. And in my opinion that's more inline with how vim's other commands behave (e.g. ciw).
Am I doing something wrong, or is this intentional? If so, why?
This is even worse with HTML tags. ysiw<a>\Rj.<a>\Rj.<a>\Rj.<a>\Rj.<a>\Rj.<a>\Rj.<a>\Rj.<a>\R. Arrrrgggghh.
I wouldn't call it intentional, but it is an unfortunate limitation of how Vim handles operator maps. When you press ysiw, the end result is that Vim calls a function and tells it something like "line 12 column 34 through line 12 column 39". Nowhere does it provide us with iw, and thus there's no way for us to record it for next time. Instead, Vim's built in repeat operator takes over and screws it up.
Luckily for you, the particular use case of iw has a simple workaround: press csw". I added this when feeling the exact same pain you are.
As far as the HTML tag stuff goes, it's probably solvable, just tricky. See #31 for a failed attempt.
Scratch that last part. The HTML thing has been solved.
Holy crap! Drawing my attention to the way . almost works has given me a brilliantly simple idea: call the native . from the overridden .. It works!
This is probably applicable to commentary.vim and unimpaired.vim as well. Oh frabjous day!
Even better, it already works on commentary.vim and unimpaired.vim. I had just always assumed the worst. I'm hoping something has changed in Vim since I first wrote surround.vim because it's disappointing to think I would have missed this the first time around.
Seems to work nicely with stuff like brackets and quotes, but doesn't work with html tags it seems. Though csw is awesome and seems to work fine with all variations I can throw at it, thanks for pointing that out :)
Didn't try that particular edge case. Fixed.