Say I'm writing some repetitive code like:
add(x+1)
add(x+2)
add(x+3)
add(x+4)
How can I use vim's column editing to make say 1000 lines of this code with the same pattern?
type one line: add(x+1), then type in normal mode:
qqYp<ctrl-a>q
to record one macro. Now you can just 999@q to have 1000 lines in this pattern.
g<c-a>type one line: add(x+1), then type in normal mode:
Y999p
Now you have 1000 duplicated lines with +1), then:
2G<ctrl-v>}g<ctrl-a>
You got it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With