Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


To avoid the "07" -> "010" problem you can add

    set nrformats-=octal
to your .vimrc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: