I know this is going to sound like a nit-picky question that isn’t very important, but it actually proves to be a source of frustration for me.
Occasionally I will use the dot operator “.” on a pointer type when I meant to use an arrow “->”. To fix it, I usually need to change just 2-3 dots to arrows, but I can’t seem to find a way to do this in vim that doesn’t take a relatively large amount of keystrokes for the amount of text I am changing.
For example, I could do:
:lineNum,lineNum s/\<objectName\>\./->/g
But that is quite a lot of typing if there are only 2-3 instances.
Alternatively, I can use jkhl to navigate to each period, and do:
r-a><ESC>
But five keystrokes for each one seems like torture after using jkhl to find all three, as well as the mental context switch that comes with entering and exiting insert mode so quickly.
How do you change your dots into arrows? Have you found a method that is faster?
… etc …
each
ngoes no the next expression you searched for, and each.repeats the substitution of the dot with an arrow. mix and match ns and dots as needed.