You are not logged in.

#1 2010-05-19 16:29:06

rafaelgp
Member
From: Leicester UK
Registered: 2009-02-16
Posts: 28
Website

SOLVED: Vim increase number (ctrl+A) jumps from 07 to 010

Hello everyone!

I am trying to find the way to create multiple lines like:

pano01
pano02
pano03
etc...

This can be achieved perfectly using macros, but I have a problem with the increase number command.

When I write pano01 and press Ctrl+A several times, it jumps from pano07 to pano010. It's ok when I try with pano1, pano2, pano3, etc.. but I really need to use the number 0.

Any ideas of why this behaviour and a solution?

Thank you very much in advance.

EDIT:

I just need to type the following:

:set nrformat=alpha

Explanation why in :help ctrl-a and :help nrformat

Last edited by rafaelgp (2010-05-19 17:02:46)

Offline

#2 2010-05-19 17:00:45

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: SOLVED: Vim increase number (ctrl+A) jumps from 07 to 010

vimhelp

:help CTRL+A wrote:

The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned
octal and hexadecimal numbers and alphabetic characters.  This depends on the
'nrformats' option.
- When 'nrformats' includes "octal", Vim considers numbers starting with a '0'
  to be octal, unless the number includes a '8' or '9'.  Other numbers are
  decimal and may have a preceding minus sign.

And I recommend using visincr from Charles E. Campbell http://vim.sourceforge.net/scripts/scri … ipt_id=670

Offline

#3 2010-05-19 17:02:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: SOLVED: Vim increase number (ctrl+A) jumps from 07 to 010

And it's the same for 017 - next is 020. Some octal stuff?

Edit: OK, so I was right about the octal stuff :-)

Last edited by karol (2010-05-19 17:03:13)

Offline

Board footer

Powered by FluxBB