Pages

Wednesday, May 9, 2012

vi tricks #1

Been working with vim lately and every day I discover new tricks. I figured I'd post things here as I they might be of help not only to me, but also to the internet at large.

First up, suppose you want to insert a large number of the same character or string, for example in order to write a comment box, or something similar. Instead of typing "*" 30 or so times, thus shortening the life of the "8" key on your keyboard, you can do this, in normal mode:
 <number>i<string><ESC>  
For example, want to make a lot of $$$? Just type
300000i$<ESC>  
and you'll be set for a life(ish)!

No comments:

Post a Comment