November 2, 2011

Two Decades of Excellence: Vim Turns 20!

The Linux Foundation and the Linux community have been celebrating the 20th anniversary of the Linux kernel all year. And rightly so! But 2011 isn't just the big two-oh for the Linux kernel, it also marks the 20th anniversary of the first release of the world's best text editor. Of course, I'm talking about Vim.

Vim Logo


For those who aren't familiar with it, Vim is short for Vi Improved. Vim is actually a take on the even-older vi, the text editor written for Unix by Bill Joy. To prove that nearly all developments in computer science are iterative, vi is from the "visual" /mode of Joy's line editor, ex. And ex built on em, and so forth. 

It might sound weird these days to call a text-based editor "visual," but in the early days of Unix text editing was downright primitive. Instead of seeing a full screen of text as we're now used to, you got a single line of text and some fairly arcane commands. If you'd like to get a taste of just how primitive, try editing a document using just ex, or even earlier versions of Unix editors like em or ed.

Developers were hard up against serious resource constraints, so luxuries like updating text as it was typed were new and novel. Remember that users often worked with primitive terminals like the ADM-3A. The ADM-3A offered a whopping 12-inch black and white CRT screen with 12 rows of 80 characters.

The keyboards were no luxury, either. Today, the standard US layout for most keyboards includes 104 keys. This doesn't, of course, count all the multimedia keys. The ADM-3A keyboard had a lonely 59 key layout. No function keys, no Alt key, or Windows key. (Not that most Linux users would miss the Windows key...) Arrow keys? Nope. Hence the need for using h, j, k, and l for movement. (No "Scroll Lock" key, either, though I'm not really sure we actually need that one anyway.) The limited key set and slow connection led Joy to work out vi's unique modal system of editing, where the same keys would be used for different functions depending on what "mode" the editor was in.

If you want a good look at the beginnings of vi, check out this August 1984 interview with Joy from the now defunct Unix Review magazine. What's really interesting is that you can trace the evolution of common Unix system utilities to small teams or individuals at institutions like Berkeley or Bell Labs. In this case, Joy's vi was competing with an editor written by Mike Horton of Bell Labs – but vi won out because the local users at Berkeley supported it. Ashlee Vance also has some history in the appropriately titled "Bill Joy's greatest gift to man — the vi editor." Finally, there's an introduction to display editing with vi that's worth looking over.

How Vim Came About

Vim development was, and is, led by Bram Moolenaar. It took its origins from an editor for the Atari ST called "Stevie," but Moolenaar tinkered with it privately for a long time before finally releasing it on November 2, 1991. Moolenaar's development was on the Amiga, initially.

Vim was, of course, eventually ported to Unix. The 2.0 release was the first to carry the name "Vi Improved," and that came out in 1993. You see, Vim wasn't always the powerhouse it is today. Initially, Vim was just taking after vi because it wasn't available outside Unix. As Moolenaar continued working on Vim, it got farther away from just being a vi-like editor and actually adding a lot of features that original vi didn't (and still) doesn't have.

In 1994, Vim added support for multiple buffers and windows, in 1996 it added a color interface. The first GUI for Vim appeared in 1996, contributed mostly by Robert Webb.

Vim added syntax coloring and highlighting in 1998, and in 2001 added folding, plugins, and the vertical split feature. Vim long ago surpassed vi in features, and its extensibility means you can do just about anything you want with it.

Like Linux, Vim has come a long, long way over the years. These days you'll find it installed as the default vi-type editor on most Linux distributions as well as the default vi for Mac OS X. Even where it's not the default, it's available on just about any OS you'd like — Windows, proprietary Unixes, the BSDs, and many others.

In addition to Vim's long list of features, it has one very interesting non-technical aspect – its license. Vim is under a "charityware" license, where Moolenaar asks (but does not demand) that Vim users donate to ICCF Holland, which helps children in Uganda. Here's what Moolenaar says about his choice to create the charityware license for Vim:

"Since Vim is open-source and freely distributable, users don't have to pay to use it. Even so quite a few people who use Vim regularly expressed to me that they wanted to reward me for my work in some way. I didn't really need extra money myself and didn't like the idea of some people giving me money for a program that is free. That's when I thought of the Charityware concept. The basic idea is that everybody who uses Vim is asked to donate to a charity. Thus the use of Vim is free, but if you think it's worth something, give that money to a good cause."

"How did I chose the charity? Well, I have worked for a year as a volunteer with a project in the south of Uganda. This is an area that has been struck hard by AIDS. Estimates are that 10 to 30% of the adults are infected by HIV. Many parents die, leaving their children behind. The project helps these needy children in several ways. We find a new home for the child. We make sure the child can go to school, gets medical attention and care made to measure."

"After I returned from Uganda, my heart was still there. I decided the least I could do was to keep supporting the project by raising money for them. The connection to Vim was a very logical one. Thus now I'm asking Vim users to consider donating for the orphans in Uganda. I have also setup an adoption program. You can financially adopt a child, which means that the child gets long-lasting help, which is best for the child. Since we work only with volunteers and the money is directly sent to the project, almost all the money is really used in Uganda."

So, if you're a Vim user, I might suggest that the 20th anniversary of Vim would be a good time to make a donation to Moolenaar's favorite charity in thanks for all the hard work he's put in over the years.

If you're not a Vim user, why not start now? We've put up several pieces on Vim to help you get started:

Finally, you can also get a good start with Vim by using its built-in tutorial. Just type vimtutor and it will walk you through the basics quite handily.

Editor Wars

It would hardly be fitting to look back at 20 years of Vim without a passing mention of the rivalry between Vim and Emacs. Yes, kids, long ago people weren't having flamewars about Android vs. iOS, or Ubuntu vs. Fedora, or Windows vs. Linux. They were arguing over Emacs vs. vi, and ultimately Emacs vs. Vim — since Vim long ago took up the torch for vi after it stopped evolving.

These days, of course, there's more or less peace between the factions – though if you wish to start a discussion in a group of geeks, editor preference is usually a good conversation starter. How to stop the ensuing conversation is another question entirely.

Whether you're a hard-core Vim user, an occasional user, or have never tried Vim in your life — or even if you're an avowed Emacs user — take a second with me and wish Vim a very happy 20th. It is quite an accomplishment, and deserves to be celebrated. Here's to the next 20! :wq

Click Here!