Why I Use Vim

Posted on October 26, 2010 by Brian Jaress
Tags: story

My high school was connected to the state university, and they gave us UNIX shell accounts on the university’s machines. They also taught us how to use the pine email client and how to upload web pages using FTP.

The way they taught us to access the shell was to go to the computer lab and run the telnet program. Of course, you could run a telnet client from any machine as long as you had an Internet connection. If you didn’t have an Internet connection, the university also had direct dial-up access.1

So I was able to log in from home and from the local library.

The library had a bunch of dumb terminals hooked to a server in the basement. They had big, clacking keyboards and screens that showed nothing but orange text, but they gave you access to some kind of custom program for looking things up in the library’s catalog. You could search for books and find out the dewey decimal number and whether they had it on the shelves. You could also call up a text-mode web browser2 and connect to the actual Internet.

As with most web browsers, you could type in where you wanted to go. If you typed http://altavista.com it would take you to the most popular search engine of the time. If you typed in telnet: it would shell out to a telnet client. It seemed like the most amazing thing ever that I could walk to the library after school and use an undocumented feature (undocumented by the library, anyway) to access the exact same university servers I had been accessing at school.

The only problem with sending email or updating my web site from home or the library was the inconsistent connection. Sometimes I’d press a key and get almost instant results. Other times there would be a couple seconds of delay as the keystrokes went up to the university server and the screen updates came back.

That made it painful to use pico, the text editor that comes with pine for actually writing emails and which I had been using to edit my web site. It wasn’t the typing so much as the moving around: skipping up a few paragraphs to insert extra information, going back over a sentence to fix typos, or moving a paragraph to another part of the text.

In pico, you move ten lines up by pressing the up arrow key (or Ctl-P) ten times. The typical thing to do is just hold the arrow key down until you get where you want to be. If you’re a little off, you fix it with a few taps of one of the arrow keys. With a fluctuating (and often long) delay between pressing a key and seeing the result, that didn’t work.

If I let go of the arrow key and started typing when I saw the cursor in the right place, the cursor might stay there doing nothing for a couple seconds, then jump to another place as a bunch of additional arrow key presses went through, then insert the text I’d been typing at the new location. The way around it was to press the arrow key ten individual times, counting off each press.

So I looked for a different text editor.

There turned out to be a lot of options, but the two most popular were Emacs and vi. Emacs was known for being extremely powerful, with the main criticism being that it was too powerful. The standard derogatory joke was that Emacs is a nice operating system, but it comes with a lousy text editor. On the other hand, vi was known for being efficient but cryptic, with commands designed for slow connections rather than for intuitive ease.

“Designed for slow connections” sounded like a good thing in my case, so I gave vi a try. One way to go up ten lines in vi is to type 10k. That seemed as strange to me as did to anyone else, but it was a lot easier than counting off ten presses of the up arrow.

At first I used the default vi on the university’s machines3, but eventually I switched to Vim, the most popular (and probably the most feature-filled) version of vi. I still only know a tiny fraction of the features, but I’ve used it ever since. Every now and then I’ll learn a Vim trick I didn’t know or read an article about it full of things I didn’t know.

I’ve stuck with Vim mostly out of habit. It’s not that non-vi editors are inferior, they’re just so different that it feels strange to switch. If I’d had a better connection back in high school, I might be using pico or Emacs or who knows what.

I recently had a job where we used Eclipse, a full-blown IDE that integrated into our tools. I’d still often use Vim, sometimes editing the same file in both programs at the same time. The job is over, and I don’t know if I’ll ever use Eclipse again–but I’m typing this in Vim.


  1. The university had a helpful “How can I use my account?” page.↩︎

  2. Lynx, I think.↩︎

  3. I think they were running Solaris.↩︎