Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does incrementing with CTRL-A in Vim take me from "07" to "10"?

Tags:

vim

I have a series of numbers in Mac Terminal Vim which I am incrementing by pressing CTRL-A. Strangley, when I am at 07, the number skips up to 010 instead of 08. I just tried MacVim and had the same behavior occur. Does anyone know why?

Note: Both Vim's work perfectly for 7.

like image 766
ovatsug25 Avatar asked Nov 07 '12 16:11

ovatsug25


People also ask

How do you decrement numbers in vim?

In normal mode, typing Ctrl-A will increment the next number, and typing Ctrl-X will decrement the next number. The number can be at the cursor, or to the right of the cursor (on the same line). These are the defaults for Vim, although some scripts remap these keys to perform other functions.


1 Answers

If you don't want to increment numbers in octal notation, :set nrformats-=octal.

like image 117
Dan Fitch Avatar answered Sep 29 '22 11:09

Dan Fitch