I have the phrase "3-4 years" in a vim document and want to change it into "4-5 years".
Cursor over "3", C-a increments it to "4". Good.
Cursor over the "4" after the hyphen, C-a surprisingly decrements it to "3". Repeating the action eventually produces "40 years" (hyphen deleted), after which C-a increments properly to "41 years", etc.
Curious. I suppose vim is treating "4-4" as subtraction rather than a date range. "4-3" is indeed one more than "4-4".
I tested the idea by replacing my all-purpose ASCII hyphen with an
en-dash, – (–
). In that case, C-a increments 4–4 to 4–5 as
expected.
That doesn't explain why "4-1" becomes "40" when the "1" is decremented, though.
Update, 20120404: It has been pointed out to me that vim must be looking no further to the left than the hyphen, treating "4" and "-3" as separate numbers. After "-1" has been incremented to "0", it is seen together with "4" as part of the number "40", which is then incremented to "41".