Being able to insert a value that changes for each execution of a macro can be useful. In this tip, we'll learn a technique for incrementing a number as we record a macro so that we can insert the numbers 1 to 5 on consecutive lines.
Rudimentary Vim Script
create a variable called i and assign it a value of 0.
allows us to inspect the current value assigned to a variable.
insert the value stored in variable.
tells Vim to execute the macro on each of the selected lines. the value of i gets incremented each time the macro executes.