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.
: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.
:set nrformats+=alpha
By default, and only increment and decrement numbers (decimal, hex, and octal depending on format).
<C-v>jj<C-a>
Select numbers with visual block mode , then press to increment all selected numbers by 1.
qaYp<C-a>q
Record a macro that yanks the current line, pastes it below, and increments the number with .
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.