Contact Info

(for those who care)

Instant Gratification   



Wed, 31 Jan 2007

The Zen of Vim

I’ve used Vim since about 1999. Call it 7 years and 2 major versions. There’s a lot I take for granted about Vim and a lot of features that I take advantage of that often surprise people when they see me edit text.

I recently came across a spate of links on learning how to use Vim effectively, so take this as a consolidated collection, a distillation of the best way to learn Vim from someone who knows it fairly well.

First start with this wonderful collection of Vim cheat sheets (local html mirror, local zip mirror). Think of it like World of Warcraft for your editing: “Dude, I’m on Level 3 of Vim!” It’s a bunch of cheat-sheets that break down the 100’s of commands into useful groupings that are fairly straightforward to start integrating into your workflow. It’s important for your long-term sanity that you start with “vim”, not “vi” … they’re the same at the core, but behave very differently in the long run– the difference between a Model-T and a Modern Car.

Update 2008-04-16 Also hit the Semi-Official IBM DeveloperWorks vi Cheat Sheet

If you’re just starting out learning Vim, you’ll probably want to practice with something like vimtutor, but for the love of all that’s good in the world, stay away from vigor.

Next read Mr. McPherson’s guide to effective editing with Vim (local mirror), as he’ll give you a taste of what features an advanced user will find useful, and what begins to set Vim apart from most other editors.

Finally, go straight to the source to read Bram Moolenaar’s guide to effective Vim habits (local mirror). It’s a bit dense for novices as he is the primary author of Vim, but his commentary should start to make sense around Lesson 6 or so of the graphical guides.

My small contribution to this wealth of knowledge is the “:Explore”, “:Sexplore” (split and explore), “:vsplit” and “:vnew” for grins and “Ctrl-W,Ctrl-W” or “Ctrl-W,{motion}” (window navigation). Oh, and who could forget vim tip #102, simple tab completion or any of the other hidden gems you’ll find at vim.org.

If you’ve given Vim a week or two and still can’t wrap your fingers around it, don’t throw it away just yet. There’s a project called Cream that uses the extremely powerful “core” of Vim, keeping it’s ability to open multi-megabyte files with ease, but hides all the nasty keyboard shortcuts and actively encourages you to use the mouse and arrow keys like any other normal editor. Think of it as the one true replacement for notepad.exe if nothing else.

You may now return to your regularly scheduled programming.

00:25 CST | category / entries
permanent link | comments?

Like what you just read? Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.



Thanks for Visiting!