I am a vim user, and I want to be able to loop over a range of substrings when I am substituting. How can I use some vim magic to go from a set of lines like this:
This is how I'd attempt that macro.
qa Records macro in buffer a
/foo Search for the next instance of 'foo'
3s Change the next three characters
bar To the word bar
Back to command mode.
n Get the next instance of foo
. Repeat last command
n Get the next instance of foo
3s Change next three letters
baz To the word bar
Back to command mode.
. Repeat last command
q Stop recording.
1000@a Do a many times.
Any advice on how to do it better is welcome.
thanks, Martin.