DEV Community

Vivian Voss
Vivian Voss

Posted on • Originally published at vivianvoss.net

vi

Technical Beauty — Episode 28

2.7 million people have visited Stack Overflow to learn how to exit a text editor. One in every 20,000 visitors. During peak hours, 80 people per hour, trapped in a program they opened by accident.

The most feared tool in computing is also the most elegant. One does appreciate the irony.

The Constraint

  1. Bill Joy, graduate student at Berkeley, writing code over a 300 baud modem on an ADM-3A terminal. The screen redraws slower than he can think. Every keystroke costs time. Every wasted character is a visible delay.

So he built an editor where nothing is wasted. No menus. No mouse. No chrome. Every key does something. The Escape key sits where Tab sits today, because on the ADM-3A it was one finger away. hjkl navigates because the ADM-3A printed arrows on those keys. Colon enters command mode because on that keyboard, colon required no Shift.

vi was not designed for comfort. It was designed for a 300 baud modem. The constraint produced the grammar.

The Grammar

vi is not an editor. It is a language.

d3w: delete three words. ciw: change inner word. yy: yank this line. p: put it back. Every command composes: a verb, a count, a noun. Learn 10 verbs and 10 nouns and you have 100 commands. Learn 20 of each and you have 400.

No other editor works this way. Every other editor maps actions to key combinations: Ctrl+C, Ctrl+V, Ctrl+Shift+K. Fixed bindings. Memorised, not understood. vi gives you a grammar and lets you write sentences you have never written before.

A three-year-old composes sentences from verbs and nouns without memorising every possible combination. That is how vi works. One rather suspects the linguists would approve.

The Numbers

vi is specified in POSIX. It ships with every Unix system. Every BSD server. Every Linux. Every macOS. It has been there since 1976. Fifty years of production.

Bram Moolenaar took vi and built Vim in 1991. He maintained it for 32 years, coined the term "charityware," and asked users to donate to orphans in Uganda instead of paying for the software. He died on 3 August 2023, aged 62. The editor he built runs on more machines than any other text editor in history.

Vim: 380,000 lines of C. VS Code: Electron, Chromium, Node.js, hundreds of megabytes. Both edit text.

The Point

The constraints of 1976 produced an editing grammar that no modern editor has matched. Not because modern editors lack features. Because they lack a language.

vi is a 50-year-old proof that designing for constraints produces tools that outlast the constraints themselves.

Read the full article on vivianvoss.net →


By Vivian Voss — System Architect & Software Developer. Follow me on LinkedIn for daily technical writing.

Top comments (0)