Sorry this page looks weird. It was automatically migrated from my old blog, which had a different layout and different CSS.

Passionate About Vim

I first encountered Vi on a Solaris training course and I couldn’t believe how bad it was. And not just bad but mean. I felt that Vi was out to make things difficult just for me (a wonderful mix of self-pity and egotism there!).

The instructor explained that Vi had been developed for use over narrow bandwidth connections and the commands were designed to be as economical as possible with keystrokes — sort of like a Huffman code for editing text. And this was why one had to type, somewhat cryptically, :wq to save and quit.

It reminded me of my first encounter with Emacs in the university engineering department. With nobody around to ask and no visible documentation, it took me 20 minutes to quit it. (In fact I didn’t manage to; I got so frustrated that I logged off and hoped that it would go away before I returned the next day.)

Eventually I learned enough Emacs to to write a dissertation in LaTeX, but I never felt strongly about Emacs. It was ok. Since then I have developed a grudging respect for Emacs: any software using Lisp for configuration has a certain warped genius.

Fast forward a few years and I was coding for one of Europe’s largest hedge funds. We had Windows boxes and used TextPad. This was a huge step forward as far as I was concerned: syntax highlighting, regular expressions, customisable behaviour, etc. TextPad is still the editor I recommend to those on Windows, though newcomer e looks promising.

After a few months though, I realised my right thumb was sore from constantly using the cursor keys to move around. I knew I would either have to change the way I edited text or endure RSI. And so I started looking for a new text editor: one that wouldn’t use cursor keys to move around; one that would let me keep my hands on the home keys as much as possible and would minimise awkward key combinations. And, while we’re at it, one that would work on Windows (for our development boxes) and Linux (our production servers). I read Seven Habits of Effective Text Editing and it made perfect sense.

My search led me to Vim. Oh no.

Vim is Vi improved. It doesn’t make you use cursor keys to move around — instead hjkl for left, down, up and right — it minimises the number of awkward key combinations, unlike Emacs, and it’s cross-platform.

So I reneged on my promise never to touch Vi or its ilk again and installed Vim.

It was slow progress. In terms of learning curve I would rank Vim with windsurfing. Each step takes a lot of perseverance but, after a few weeks and months of practice, you start flying along. No more sore thumb and much higher productivity. Yay! I no longer hated it.

Over time you discover handy techniques likes editing remote files, surprisingly good diffing and changing multiple files simultaneously. I was getting to like it.

And then one day I opened up Vim and realised, to my surprise, that I thought it was wonderful. It had gone from being the only software I hated to more or less the only software I loved.

I think this is what Kathy Sierra is getting at when she talks about avoiding the zone of mediocrity. Vim is certainly not mediocre and I love it.

Comments

After years of giving it suspicious looks and the occasional, but unavoidable, beating when undertaking the server-side editing of shell scripts and config files at the hands of Ye Olde Vi, I still struggle. When I use it I understand how our parents feel when they try to use Word. And what’s wrong with SCPing a text file onto your Windows box, editing it Textpad and then SCPing it back? Oh.

I know I could overcome this with courage and patience, but a decade has passed and I still can’t bring myself to do it. So, congratulations and, in equal amounts, commiserations to all you Vim masters (Vimsters?) :-)

Olly • 22 November 2006

One certainly can scp a text file to your local box, edit it and scp it back again — nothing wrong with that.

It’s like enjoying a night in with a DVD and takeaway. You could get in your car, drive down to the video shop, call by the curry house and come home again; watch the film; and then get in your car, drive down to the video shop to drop off the DVD and come home again.

Or you could just get Amazon to post the DVD to you, phone the curry house for a delivery, and let other people bring the goods to you; watch the film; and then drop the DVD in a letter box the following day.

You get to watch the film in both cases, but life is easier when other people handle the logistics. Hmm — that would make a good motto!

Andy • 23 November 2006

Andrew Stewart • 22 November 2006 • Vim
You can reach me by email or on Twitter.