Bill Joy's greatest gift to man – the vi editor

Out of all of Bill Joy's contributions to technology, users appear most fond of one of the simplest - the vi editor.

Joy leaves a lasting legacy of work both in the general technology domain and at Sun Microsystems. The Sun co-founder announced this week that he is leaving the company. Among Joy's list of achievements are BSD Unix, NFS, UltraSPARC designs and some work on Java. But it's vi, created in 1976, that really captured Reg readers' hearts.

"Bill's greatest gift to mankind was left off his list of achievements (in your article)... the vi editor," writes reader Matthew Hawkins in Australia. "I can live without NFS, Java and related technologies. I'm not sure if I can live without vi."

Matthew is not alone in his feelings. Other readers called vi, "Joy's lasting contribution to humanity" and agreed they could not have worked without it.

To do vi justice, we turn to Linux Magazine, which has one of the best accounts of how Joy came up with this little gem.

What happened is that Ken Thompson came to Berkeley and brought this broken Pascal system, and we got this summer job to fix it. While we were fixing it, we got frustrated with the editor we were using which was named ed. ed is certainly frustrating.

We got this code from a guy named George Coulouris at University College in London* called em - Editor for Mortals - since only immortals could use ed to do anything. By the way, before that summer, we could only type in uppercase. That summer we got lowercase ROMs for our terminals. It was really exciting to finally use lowercase.

So we modified em and created en. I don't know if there was an eo or an ep but finally there was ex. [laughter] I remember en but I don't know how it got to ex. So I had a terminal at home and a 300 baud modem so the cursor could move around and I just stayed up all night for a few months and wrote vi.

Linux Mag then asked: "So you didn't really write vi in one weekend like everybody says?"

No. It took a long time. It was really hard to do because you've got to remember that I was trying to make it usable over a 300 baud modem. That's also the reason you have all these funny commands. It just barely worked to use a screen editor over a modem. It was just barely fast enough. A 1200 baud modem was an upgrade. 1200 baud now is pretty slow.

9600 baud is faster than you can read. 1200 baud is way slower. So the editor was optimized so that you could edit and feel productive when it was painting slower than you could think. Now that computers are so much faster than you can think, nobody understands this anymore.

The people doing Emacs were sitting in labs at MIT with what were essentially fibre-channel links to the host, in contemporary terms. They were working on a PDP-10, which was a huge machine by comparison, with infinitely fast screens.

So they could have funny commands with the screen shimmering and all that, and meanwhile, I'm sitting at home in sort of World War II surplus housing at Berkeley with a modem and a terminal that can just barely get the cursor off the bottom line.

It was a world that is now extinct. People don't know that vi was written for a world that doesn't exist anymore - unless you decide to get a satellite phone and use it to connect to the Net at 2400 baud, in which case you'll realize that the Net is not usable at 2400 baud. It used to be perfectly usable at 1200 baud. But these days you can't use the Web at 2400 baud because the ads are 24KB.

That's just a bit of background on the creation of vi. Enterprising types can take a peek here and here for more information on Joy's vi work and the history of BSD Unix. For the record, Reg readers did put Joy's work writing the TCP/IP stack for BSD right up there with vi. ®

* Shortly after our story posted, Keith Clarke - a friend of George Coulouris - contacted The Reg with some updated information. Coulouris was actually at Queen Mary College, University of London and not University College in London, as Joy recalled.

Coulouris then contacted us with some other fresh insights. Many thanks, Keith and George.

Of course Keith is correct in saying that I was a Lecturer at Queen Mary College, University of London when I wrote the 'em' editor. There's a bit more about what it was and how I came to pass it to Bill Joy on the web page that Keith has already cited. There is some stuff about the design of 'em' appended at the end of the page.

Paradoxically, I think we had more experience in screen-based interaction at the time than Bell Labs or Berkeley and it was for that reason that I saw the need for a screen editor. It was less powerful than 'vi' in that it allowed the cursor to move only within a single line. This constraint arose mainly from the desire to make it work on the variety of vdu's (and even the TTYs) that we had available at the time. But a full-screen editor is a lot more work to write and Bill deserves most of the credit he has received. Having said that, 'vi' would probably never have seen the light of day if I hadn't sat down at the terminal next to him at Berkeley in the summer of 1976 and I wouldn't be surprised if some of my code lives on in 'vi'.

Best wishes,
George Coulouris
Emeritus Professor of Computer Systems
Queen Mary, University of London
and
Senior Visiting Fellow
Laboratory for Communication Engineering
Department of Engineering, University of Cambridge