Say I have something like
a & 1234567890
b & 1234567890
c & 1234567890
d & 1234567890
e & 1234567890
f & 1234567890
Is there a way to use a vim macro such that I can run a macro/command x amount of times per line, where x depends on the line?
In this case, I run 2wx^ on each line x times, where x is the line number such that the result becomes
a & 234567890
b & 34567890
c & 4567890
d & 567890
e & 67890
f & 7890
Thanks in advance
If your macro is recorded in register
q, then you can run:on any line you want. Your macro will want the cursor kept on 1st column before being run.
You can also probably do it - better - in a different way, if you describe what you want to do. For example, perhaps you could skip the macro altogether and use something like this instead:
If you need a line offset (e.g. of
1), you could use: