Incrementing And Decrementing Numbers
21. 3. 2020; Vim
Some of you might know that pressing
/
in command mode increases/decreases the next number on the line the cursor is currently on:
There is 12 apples. --> There is 13 apples.
But did you also know that it can handle other bases and even alphabetical characters (worked for me but might need to be configured – see this wiki article):
There is 0b1100 apples. --> There is 0b1101 apples.
There is 0xc apples. --> There is 0xb apples.
This is 'a'. --> This is 'b'.
Equipped with this knowledge, one can easily add to and subtract from any number (10
), create a list of numbers in a given base (a relatively simple macro), play around with caesar cypers and generally do many things that would likely not be possible in other text editors.