When it comes to the most popular text editor on Linux systems, some history is hidden in plain sight. In text files scattered around the web — and through the occasional YouTube video — it’s possible to trace the early history of the Unix-based text editors that went on to become Vim, still in wide use more than 40 years later.
It’s a reminder that in the developer community, we’re always standing on the shoulders of those who came before — and of what the early days of computing were really like. “[B]efore that summer, we could only type in uppercase,” Vim creator Bill Joy told Linux Magazine. “That summer we got lowercase ROMs for our terminals. It was really exciting to finally use lowercase.”
Joy wrote vi around 1976 — six years before he co-founded Sun Microsystems — while he was still a graduate student at U.C. Berkeley. Before that he’d been using the ed text editor — originally written by Unix pioneer Ken Thompson in 1969. Thompson himself had visited Berkeley, and left behind a broken Pascal system. In the summer of 1976, Joy’s job was to fix it.
“ed is certainly frustrating,” Joy remembered.
But there was also a fateful visitor that summer from Queen Mary College, University of London — specifically George Coulouris, who later described their meeting in the book “A Quarter Century of UNIX.” Coulouris had brought along a Dectape with the code for a text editor of his own, a modification of ed which he’d named “em” — a shortened version of “ed for mortals.”
“I christened it that after Ken Thompson visited our lab at QMC while I was developing it and said something like: ‘yeah, I’ve seen editors like that, but I don’t feel a need for them, I don’t want to see the state of the file when I’m editing’.”
For years to come, Coulouris remained proud of his contribution to the early days of software development, judging by his 2003 comments to the tech site the Register. While applauding Bill Joy for expanding his single-line editor into a full-screen editor, “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’.”
So what happened next? “We modified em and created en,” Bill Joy told Linux Magazine. Working with Chuck Haley, the pair kept adding features — Haley added the ability to move the cursor along the bottom line, according to another interview Joy gave to Unix Review back in 1984 — back when Joy was still in his 20s. “Chuck would come in at night — we really didn’t work exactly the same hours although we overlapped in the afternoon. I’d break the editor and he’d fix it and then he’d break it and I’d fix it…”
The pair eventually worked their way up from em to ex, which was included in the first release of BSD Unix in March of 1978. And it was in the second release of BSD Unix — in May of 1979 — that the program was finally installed under its now-familiar name vi — a name which indicated to users that it was ex launched in its visual mode.
There’s a myth that Bill Joy whipped up vi over a weekend, but Joy emphatically 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,” Joy told Unix Review. “That’s also the reason you have all these funny [single-letter] commands. It just barely worked to use a screen editor over a modem. It was just barely fast enough…”
To this day, that accounts for at least some of the rhythm of editing with vi. “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,” Joy said. “It was a world that is now extinct. People don’t know that vi was written for a world that doesn’t exist anymore.”
There’s other echoes of 1977 that are built into the program. Joy’s video terminal had a built-in keyboard with no cursor keys — which explains why Vim uses the h, j, k, and l keys to navigate (though it now also supports cursor keys).
Sinclair Target, who’s been working as a software engineer since he graduated from Columbia in 2015, recently pulled together the threads for his own history of Vim. And there’s other ed commands from 1969 that survive in vim to this day. ed was also “modal” — meaning you had to toggle on the “input” mode with the i key, notes Target. “ed also introduced the s/foo/bar/g syntax for finding and replacing, or ‘substituting,’ text.”
“Fundamentally, vi is still ed inside,” Joy told Unix Review in 1994. “You can’t really fool it.”
Target notes that in the days before GNU Emacs, it could cost hundreds of dollars to install Emacs. “So vi became enormously popular.” But Unix Review asked Joy the ultimate question — is there’s anything he’d do differently? “One of the good things about EMACS… is its programmability and the modelessness. Those are two ideas which never occurred to me.”
And in addition, “I wish we hadn’t used all the keys on the keyboard… The fundamental problem with vi is that it doesn’t have a mouse and therefore you’ve got all these commands….”
But the first version of vi had an even bigger problem, Target points out. “vi was a direct descendant of ed, which meant that the source code could not be modified without an AT&T source license. This motivated several people to create open-source versions of vi.” The software had names like Elvis, nvi, and STEVIE (ST Editor for VI Enthusiasts) — which was later adapted into a software called Vim, which originally stood for “Vi iMitation.” Created by Dutch computer programmer Bram Moolenaar for his Amiga, Vim entered the world the same year that Linus Torvalds released his first Linux kernel — in 1991.
Moolenaar started with the open source code for STEVIE, then added a few customizations, according to a lecture he gave on the 25th anniversary of Vim. “I did all the things that I just wanted myself, to be able to write text.” It was distributed on floppy disks of “shareware” circulated among computer user groups, and Moolenaar discovered that it was surprisingly popular. Soon Vim had been ported to other operating systems of time — the MS-DOS port was written by Juergen Weigert, who also ported Vim to SunOS and Linux.
Because “there was no real internet yet,” early versions of Vim were hosted on the servers of his employer, Oce (a Canon company that sells copier-related hardware and software). Moolenaar also remembers posting the second version to the Usenet newsgroup comp.sources.misc. (“I think, in like 40, parts,” he remembers — since large programs had to be split into several posts.) Over time people began sending patches to Moolenaar, and the 30-year-old programmer soon became Vim’s maintainer, release manager, and benevolent dictator for life. Target writes succinctly that Moolenaar, “with the occasional help of various internet collaborators, added features to Vim at a steady clip.”
Looking back over the editor’s gradual evolution, Target writes that “good ideas accumulated gradually over time.”
” I don’t think the ‘startup-company-throws-away all-precedents-and-creates-disruptive-new-software’ approach to development is necessarily bad, but Vim is a reminder that the collaborative and incremental approach can also yield wonders.”
This week's post: Parsing Vim's prestigious pedigree!https://t.co/1YUszI5dIC
— TwoBitHistory (@TwoBitHistory) August 5, 2018
Target’s site reminds us that Vim is pre-installed in the MacOS, there are versions for Windows, and “It is familiar even to people that hate it because enough popular command line tools will throw users into Vim by default that the uninitiated getting trapped in Vim has become a meme.”
— Adrian Hornsby (@adhorn) May 24, 2017
Joel Spolsky, the CEO of Stack Overflow, once joked that instead of dog years, “We measure the years of Stack Overflow in how many times we helped somebody get out of the Vim editor.” At the We Are Developers conference in Vienna in May, he told the audience that “We are now at 1.5 million times that somebody has viewed the question, ‘How do I exit Vim’ on Stack Overflow, which is almost our most popular question.”
Target points out that after four decades of development, Vim has seeped into the culture of the technology world. “There are major websites, including Facebook, that will scroll down when you press the j key and up when you press the k key — the unlikely high-water mark of Vim’s spread through digital culture.” And of course, Vim got a mention in a memorable scene in Silicon Valley.
And this March Linux Journal polled its readers — and concluded that Vim was the most-preferred text editor (with 35 percent of the votes, but far ahead of the 19 percent who chose Emacs, with other votes going to Sublime Text (10 percent) and Atom (8 percent).
So it’s fascinating to look back to 1999, when Linux Magazine asked Bill Joy a thoughtful question: did he know he was working on something world-changing? “No….” says Joy emphatically.
“I probably constantly underestimated it.”
- Remembering Gerald M. Weinberg, author of The Psychology of Computer Programming.
- Student AI coders built a deep-learning algorithm that’s faster than Google’s.
- Can machine learning unmask anonymous authors of code?
- A math professor uses statistical analysis to determine which Beatle really wrote “In My Life”.
- An engineer taught a drone to herd birds away from an airport.
The New Stack is a wholly owned subsidiary of Insight Partners. TNS owner Insight Partners is an investor in the following companies: Real.