Re:Vim anti-patterns
by ilikepi on Tuesday February 07, 2012 @03:21PM
(#3563491)
I've been using those more and more recently and have noticed a couple interesting things to be aware of. First, Vim interprets a dash character immediately preceding the number as a negative sign. (In playing around a bit I suspect this behavior is slightly influenced by the syntax rules for the particular filetype you're working with.) The effect of this is to flip the behavior of CTRL-A and CTRL-X. Secondly, if the first digit of the number is '0', Vim will behave as if the number is octal, so incrementing "07" once will result in "010". Similarly, a prefix of "0x" or "0X" will cause a number to be treated as hex.
[ Parent
| on HN ]
Re:Vim anti-patterns
by johncoltrane on Tuesday February 07, 2012 @05:22PM
(#3563914)
To avoid the "07" -> "010" problem you can add
set nrformats-=octal
to your .vimrc.