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.

0 responses to 'More vim tricks..'

Showing last 0 comments... (Click here to view all comments)


Leave a reply

You need javascript enabled to use this form. Anti-spam efforts ongoing. Also, if the comment doesn't show up, it's because the form expired. Go back and copy your comment, reload the form, and resubmit. Apologies if this is a hassle, I'm just playing with antispam methods right now. If this insists on not working, please email me about it.

Name (required)
E-mail (optional, if you want me to be able to email you back)
URL (also optional)
Comment: