I need to do the following:
- Set a variable
tempto some value (say 100). - Go somewhere to increase a number by
tempfor a range of lines. - Update
tempto be +100. - Repeat
I started by setting the value 100 to temp using let temp=100.
I then figure out the following ex command that I can apply to a line: :execute "normal! ". temp. "^A" this will take temp and increase the number by temp for the current line.
Unfortunately, this will not work when I visually select a range of lines and then hit : to apply a command to all the lines selected.
How can I achieve the same but for a range of lines?
Here is an example:
1
2
3
4
5
Should become
101
102
103
104
105
Then I will update the temp to let temp=temp + 100 and repeat for the next block and so on.
Thanks!