Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to write a long XML catalog using vim macros to write all the repetitive stuff. I've found it's useful to write a macro yanking the previous entry, then going through each item and incrementing it with Ctrl+A. Vim does OK with incrementing 001 to 002, all the way through 007, but then it increments 007 to 010! Also, bizarrely, it increments 008 to 9, taking out the leading zeros.

Does anyone know what is causing this bizarre bug, and how to fix it?

share|improve this question

1 Answer 1

up vote 8 down vote accepted
set nrformats-=octal

will handle it. The problem you're having is because Vim considers numbers starting with 0 octal or hex, depending. More on that in

help 'nrformats'
share|improve this answer
    
Thanks. This works a charm. And now I know what octal numbers are, and about different number formats in vim. –  Jon Nov 27 '11 at 21:24
    
@Jon - Glad it helped. –  ldigas Nov 27 '11 at 22:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.