All About Web Hosting

A repository for all kinds of useful web hosting information

Handy VI tip – using buffers and macros

leave a comment »

I do nearly all my coding in vim – other than the occasional use of textpad when I don’t have ssh access to a website… I like vim because I prefer working on the server – everything’s there, and there’s no time wasted uploading/download, etc. And you can also use things like grep to help you get things done.

Two of the handiest features in vim are buffers and macros. (Are there such thing as freudian typos? I keep mis-typing “buffers” as “buggers”… lol). Buffers allow you to quickly pull text into a little spot in memory – it’s like the clipboard that every (modern) OS has, except that you have a lot of them available. Basically you assign a letter (or number I think) to the buffer, and copy/paste using that. This vim buffer example has more info.

Macros are even handier, in my opinion – especially when used in conjunction with buffers. Basically, they record all your key strokes, and since vim is a console program, that means a macro records everything. With some clever use of searching, etc you can use a macro to automate just about any repetitive task you can imagine.  Here’s some great vim macro examples.

Written by web hosting guy

October 3, 2008 at 3:09 pm

Posted in Uncategorized

Tagged with ,

Leave a Reply