In Vim, numbers can be incremented by 1 by pressing control+a on a line with a number (and you are on the number or to the left of the number.)
Decrementing numbers by 1 in Vim works the same way as incrementing, the only change is control+x is pressed instead of control+a on a line with a number (and you are on the number or to the left of the number.)
To increment the number by something other than 1, that number would be typed in before before pressing control+a. Decrementing by a number other than one works the same as incrementing only the number would be pressed before control-x is pressed.
Incrementing/decrementing numbers can be used in macros
In this video tutorial, we also copy a macro and see we need to press control+v to before we can add control+x to our copied macro.
We use Visual Block mode to update a group increment a block of numbers
We insert line numbers in the lines in the document, then we look at how to left justify right justify and zero fill to the left of the line number we added.
See the complete Vim playlist at:
https://www.youtube.com/watch?v=1lzXr-MztOU
See the complete Vim playlist in a single video at:
https://www.youtube.com/watch?v=3G6kAEvbv2A
Website link:
https://thefrugalcomputerguy.com/linux/seriespg.php?ser=10002
7 Comments