Monday, January 30, 2012

Vim Notes

I love vim. I mean, there are a couple of great GUI editors that I like, but when I'm working in a terminal, vim is not just my editor of choice, but I actually prefer it to a bunch of other GUI editors I could choose from. The problem is that there is SO much to know. I've got the basics down, since I've been using it for over 20 years, but I honestly haven't taken the time to learn some of the more intermediate to advanced features until recently. I thought I'd keep some notes along the way in this blog post. Enjoy!

To paste in yanked lines and have them indent with the surrounding code, use ']p' instead of just 'p'
Use '>' to indent and '5>>' to indent 5 lines

Source: http://stackoverflow.com/questions/235839/how-do-i-indent-multiple-lines-quickly-in-vi

Using :split to open another document is great. But you don't always want the two windows to be equally divided, you need to make some adjustments. You could do this:

ctrl-w +

but you might have to do it over and over. Instead of typing that twenty times, just do this:

20 ctrl-w +

More goodies:
http://www.oualline.com/vim-cook.html#copy_block

No comments:

Post a Comment