3 ms·
I have used number prefixes for repeating a very pervasive change that has to be done 1000s of times. When you're in that situation no other editor is any good
by t43562 3y ago
I have used number prefixes for repeating a very pervasive change that has to be done 1000s of times. When you're in that situation no other editor is any good and it's particularly useful for a complicated change which you record as a macro.
Typically your macro starts with a regexp search for the next item to change then you have all your editing commands (including arrow keys and inserts and replaces and whatever) - a quite complicated macro, then you stop recording your macro and tell vim to do it 1000 times. if 1000 isn't enough then do it 1000 more.
You can end up with junk at the end of your file or other issues but on the whole the ability to do a macro many times is still a fabulously useful feature.
sed usually likes to work on a line-by-line basis whereas macros aren't limited to that so vim with numbers can basically do things that no other tool does.