Understanding the Origins and the Evolution of Vi & Vim

The history of both Vi & Vim goes hand in hand with the history of open-source software itself. This article is a trip back to the origins of UNIX text editors. Let's look at the important players and historical events that shaped their evolution.

history of vim text editor

I went to East London last week to visit my wife's alma mater, Queen Mary University. As I stopped to grab a cup of coffee, I received a message saying that Bram Moolenaar, the creator of Vim, had passed.

To be honest, with a new family member keeping me busy at home, and a new course on MIPS assembler that I'm recording for my school, I am finding very difficult to keep up with the latest news. So, I confess that I received the news of Bram's passing almost a week too late.

I did not know Bram personally and I am far from being a Vim connoisseur, but the fact that I was visiting Queen Mary University forced me to stop for a moment and reflect on how that place was connected to the long and vibrant history of Vim.

Queen Mary University had an important role in the history of the Vim editor. It was here that, in 1973, the first UNIX system of the UK was installed, and it was also here that professor George Coulouris developed an editor called em. The creation of em ended up snowballing into the development of vi and many other vi clones after that.

queen mary college
Queen Mary University of London, where George Coulouris taught in 1976.

Ed

The UNIX shell is extremely text-heavy. Executables are invoked via text, parameters are passed via text, streams of data flow up and down the system via text, and virtually everything in the OS shell is done with tokens of text. It is no surprise that UNIX users are so passionate about text editors.

We should probably start with ed, which was a command-line editor created by Ken Thompson designed to work well with teleprinters rather than display terminals.

teleprinter unix
Teletype Model 15 teleprinter.

Ed is what we call a line editor. Editing one line at a time made perfect sense for teleprinters, but with the popularity of video displays taking over, most users found frustrating having to work with ed. That included Queen Mary's George Coulouris, who considered ed's commands to be cryptic and not suitable for "mortals".

ed editor
Ed (line) editor.

Ken Thompson's ed was inspired by another editor called QED (quick editor). QED was also a line-oriented editor for teleprinters developed for the SDS 940 console. Ken Thompson rewrote QED using BCPL to run on MULTICS (the precursor to UNIX).

Fun fact: Ed became the defacto line-mode editor for UNIX, and it remains a part of the POSIX standard to this very day. After all, "Ed is the standard text editor".

Em

Following a series of frustrations with ed, in February of 1976, while acting as a lecturer at Queen Mary College, Coulouris decided to enhance ed using Ken Thompson's original source code as a starting point. That's how the editor em (Ed for Mortals) came to be.

Coulouris' em was designed to work well with display terminals. It was a single-line-at-a-time visual editor, and it was also one of the first programs on UNIX to make heavy use of "raw terminal input mode", in which the running program (rather than the terminal device driver) handled all keystrokes.

But George Coulouris was not the only one disappointed with ed. Across the pond, more people were getting frustrating working with Ken Thompson's line editor

Vi

When Thompson visited UC Berkeley in 1976, he brough with him a broken Pascal compiler for UNIX that needed to be fixed. Bill Joy, a student from UC Berkeley, was in charge of fixing Thompson's Pascal system. As days passed, Joy noticed that ed was holding him back.

uc berkeley
UC Berkeley, where Bill Joy was a graduate student when he developed vi.

In the summer of 1976, when George Coulouris visited UC Berkeley, he brought a DECtape containing em and showed it to various people at the university. Some considered this new type of text editor to be a resource hog, while others, including Bill Joy, were impressed with Coulouris' program.

bill joy
Bill Joy was a graduate student at UC Berkeley and wrote the vi text editor.

Inspired by Coulouris' em, and by their own tweaks to Ken Thompson's ed, Bill Joy and Chuck Haley (both graduate students at UC Berkeley) created a new editor called en. Soon after, they "extended" the en editor and created ex. In October of 1977, Bill Joy added a full-screen visual mode to ex, which came to be vi.

vi text editor
The vi editor is able to render and edit text in full-screen mode.

Both vi and ex share their code. You can think of vi as launching ex with an extra parameter to enable the capability to render and edit the text onto a computer display terminal. In reality, vi is basically ex's visual mode.

The name "vi" comes from the abbreviated ex command (vi) to enter the visual mode from within the editor. Later, as most of us probably know, vi became the actual executable name that we invoke from the UNIX shell.

Joy also mentioned that many features of vi were inspired by an editor called Bravo. Bravo was a bimodal text editor developed at Xerox PARC for the Xerox Alto.

xerox alto
Bravo was a WYSIWYG document editor with multi-font capability using Xerox Alto's bitmap display.

It's also important to mention that Bill Joy used an ADM-3A terminal to develop vi. In the ADM-3A, the Escape key is located on the far-left of the keyboard, similar to where the Tab key is located in most modern keyboards.

adm 3a terminal keyboard
Many vi shortcuts and navigation keys that we still use today were based on the ADM-3A keyboard layout.

Besides ADM-3A's influence on vi key shortcuts, we must also note that Bill Joy was developing his editor connected to an extremely slow 300 baud modem.

Bill Joy is quoted in an interview on his process of writing ex and vi:

"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."

Joy also compares the development of vi and Emacs:

"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."

Bill Joy was also the one responsible at Berkeley for the creation of the first BSD UNIX release in 1978, which included the editor ex. That helped amplify the popularity of his editor beyond the walls of UC Berkeley.

Most users were spending all their time in ex's visual mode, so Bill Joy decided to create an hard link called "vi" and add it to the second distribution of BSD in May of 1979.

Joy also claims that most of vi's popularity came from the fact that it was readily available and bundled with BSD, while other editors, like Emacs, could cost hundreds of dollars.

Vi Clones

Many clone editors were developed based on vi. The idea was to either improve the original editor by adding features to it or port the vi experience to other platforms (Atari ST, Amiga, MS-DOS, OS/2, etc.). Bram Moolenaar's Vim started out as one of these ports.

Stevie

Stevie (ST Editor for VI Enthusiasts) was a vi clone developed for the Atari ST.

Tim Thompson wrote the original version of Stevie and posted its source code as a free software to the comp.sys.atari.st newsgroup on June of 1987. Stevie was later also ported to UNIX, OS/2, and Amiga.

stevie atari st
The Stevie text editor running on the Atari ST.

One super important detail is that Stevie was programmed from scratch and did not use any of vi's source code. The vi code was based on ed's, which was developed under AT&T. Theoretically, that meant vi could only be used by those with an AT&T source license. That's also why many vi clones would choose to use Stevie's source code instead of vi's.

Elvis

Elvis is an editor that holds a special place in my heart, since it was the first vi clone I've ever used professionally. I used to live in the south of Brazil, and I just got my first job as a computer programmer.

elvis editor logo

Elvis was my first contact with the whole vi "way of doing things". We used Elvis back in the 90s to edit MUMPS and ZIM source code to run on HP-UX and Solaris servers. My first job was to migrate the old MUMPS database to use this shiny 4th gen. programming language called ZIM (which is now defunct).

Many of our customers had their servers located in remote rural areas of the country, which meant internet connection was extremely slow or inexistent. If you ever had to connect and edit text on server where everything you type takes many seconds to appear on the screen, you soon understand what Bill Joy said about vi commands being funny-looking and often invoked via single-letter instructions.

elvis vi clone
Elvis was one of the first vi clones to offer support for GUI and syntax highlighting.

Elvis creator, Steve Kirkendall, started thinking of writing his own editor after Stevie crashed on him, causing him to lose hours of work and damaging his confidence in the editor.

Stevie stored the edit buffer in RAM, which Kirkendall believed to be impractical on the MINIX operating system. One of Kirkendall's main motivation for writing his own vi clone was that his new editor stored the edit buffer in a file instead of storing it in RAM. Therefore, even if his editor crashed, the edited text could still be retrieved from that external file.

Fun fact: When asked about why the name "Elvis", Kirkendall mentioned that at least part of the reason he chose the name was to see how many people would ask him why he chose the name! Besides that, it is common for vi clones to contain the letters "vi" somewhere in their names.

Elvis pioneered many ideas that were adopted in later clones. It was admired for its conciseness and for the number of features available, besides being the first clone to provide syntax highlighting and to generalize syntax highlighting to multiple file types.

The creator of MINIX, Andrew Tanenbaum, asked the community to choose between Stevie and Elvis to be adopted as the main text editor for their OS. Elvis was chosen and it's the default text editor on MINIX until today.

Vim

And we finally arrive at Vim! Vim is arguably the most popular vi clone ever. It grew and evolved to become a monster program with a vibrant community that keeps growing. It almost feels wrong to call Vim a vi clone, but historically that's exactly what Vim was.

Inspired by a previous port of Stevie for the Commodore Amiga, Bram Moolenaar began working on Vim for the Amiga in 1988.

Yes, you read that right... Vim was originally developed for the Commodore Amiga! I'm always surprised to see that not many programmers know that, including those that use Vim daily.

Vim's first public release (v1.14) happened in 1991.

vim editor amiga
Vim v1.14 running on the Commodore Amiga's Workbench.

As you can see in the image above, the name "Vim" was an acronym for "Vi IMitation". The name changed to "Vi iMproved" in 1993.

Fun fact: A public copy of Vim for the Amiga was included in Fred Fish's disk #591. Fred Fish was a computer programmer known for his work on GNU's GDB and also for releasing a series of freeware disks for the Amiga. The Fish Disks series ran from 1986 to 1994. Fish would distribute his disks around the world, which were then distributed at computer stores and Amiga enthusiast clubs.

Basing Vim on Stevie's source code instead of using the original vi code meant the program could be distributed without requiring the AT&T source license. Vim is released under the Vim licence, which includes some charityware clauses that encourage users to consider donating to children in Uganda.

vim start screen
Vim start screen.

Moolenaar was an advocate of a NGO based in Kibaale, Uganda, which he founded to support children whose parents have died of AIDS. In 1994, he volunteered as a water and sanitation engineer for the Kibaale Children's Centre and made several return trips over the following twenty-five years.

Vim's interface, like vi, is not based on menus or icons, but on commands given to a text interface. Vim also has a GUI mode that allows users to use menus and toolbars, but the most popular Vim mode is still its text user interface under the UNIX command-line.

Vim has a vi compatibility mode, but when that mode is not used, Vim has many enhancements over vi. Some examples are Unicode support, extended regular expressions, autocompletion, syntax highlighting, and many other small IDE-like features.

Vim Today

Unlike the other vi clones, Vim is still actively developed and has a large community of users and developers. New features are still being developed and added to the text editor every year, making it even more powerful.

It also goes without saying that, besides its native features, Vim can be expanded to include one of the many (many!) third-party plugins. Combined with a powerful custom scripting language, VimScript, Vim can be transformed into an incredibly productive programming tool.

I've decided to not mention any Vim plugin or entertain the idea of listing different Vim configurations in this article, since that was not the original goal of this blog post. If you ever watched any of my lectures, you'll see that I do use Vim, but my editor configuration is extremely vanilla and, honestly, probably underwhelming. Besides some small cosmetic changes, the only plugin I added is one called YouCompleteMe. But, as I mentioned, I'm sure there are better online resources out there if all you want is to pimp your Vim.

vim text editor ide
Vim can be expanded with plugins that will almost transform your editor into an IDE-like program.

Some important milestones from the early days of Vim's development:

  • 1988: (Vim 1.0) Development of Vi IMitation on the Amiga
  • 1991: (Vim 1.14) First public release on Fred Fish disk #591
  • 1993: (Vim 1.22) Port to UNIX and renamed to Vi Improved
  • 1994: (Vim 3.0) Multiple windows
  • 1996: (Vim 4.0) Graphical User Interface
  • 1998: (Vim 5.0) Syntax highlighting
  • 2001: (Vim 6.0) Folding and multi-language
  • 2006: (Vim 7.0) On the fly spell checker and support for tabs

Vim is now more than 30 years old! The chart below shows some of the milestones and improvements of Vim in the last 20 years. The visualization was created by @mpereira, and includes an overview of Vim's development history as seen from its git repository, created in 2004. vim text editor history

The last 20 years of Vim development as seen from its git repository.

Brem Moolenaar's text editor is legendary among software developers; it has repeatedly been named in surveys as one of the most widely used text editors or IDEs, and it is still the default text editor in many modern Linux distros.

Moolenaar continued to update Vim until just a few weeks before his passing. Computing as we know it today was built in no small part by individuals like Bram, and few open source tools are as legendary and impactful as Vim.

It's humbling to look back and contemplate the history of these editors as they played a direct role in the history of computer science itself.

Being here at a Queen Mary University building, where those events took place almost 50 years ago, and using Vim to write this article is nothing short of surreal! As I stare at my blinking Vim cursor, I am overwhelmed by a warm feeling, very similar to the sensation I get when I stare at the ocean or a hundred-year old tree. It invites us to reflect on the years that came before us and the events that helped shape modern life as we know it.





Also... Emacs sucks! 😅