How do I stop <C-a> from treating leading-zero numbers as octal?
:set nrformats-=octal<CR>
By default, Vim may treat numbers with leading zeros as octal when you use and for increment/decrement.
:set nrformats-=octal<CR>
By default, Vim may treat numbers with leading zeros as octal when you use and for increment/decrement.
g<C-x>
Most people know decrements one number under the cursor, but g in Visual mode performs a sequential decrement across the selection.
:set nrformats
The nrformats option tells Vim how to interpret numbers when you press (increment) or (decrement).
:set nrformats+=bin
Vim's and commands increment and decrement numbers under the cursor, but by default they only handle decimal and hexadecimal.
{Visual}<C-a>
In Visual mode, pressing increments every number within the selection by 1 (or by a given [count]).
:set nrformats+=hex
By adding hex to the nrformats option, you tell Vim to recognise hexadecimal literals such as 0xFF or 0xDEAD when or is pressed.
:%s/\d\+/\=submatch(0)+1/g
Vim's expression replacement (\=) in substitutions lets you perform arithmetic on matched text.
<C-v>jj<C-a>
Select numbers with visual block mode , then press to increment all selected numbers by 1.
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.