Search this site


Metadata

Articles

Projects

Presentations

More vim tricks..

I've often wanted a command in vi and vim that'll increment a number that the cursor is over.
In nvi (freebsd), the command is #(+#|-) where ## and #+ will increment, #- will decrement. In vim the command is ^A and ^X. ^A increments while ^X decrements Both versions of vi let you add|subtract a given amount, for example: 300## will add 300 to the number. Replace ## with ^A in vim for the same effect. Nvi has a maximum of (+/-)2^31, while VIM has a range of (+/-)2^32.