esc
Anthology / Yagnipedia / vi

vi

The Editor That Was Already Finished
Technology · First observed 1976 (Bill Joy, UC Berkeley — a visual mode for ex, which was a visual mode for ed, which was a line editor for people who knew what they wanted to change) · Severity: Foundational — everything since has been adding features to something that was already complete

vi is a text editor written by Bill Joy in 1976. It edits text. It has been editing text for fifty years. It has not been improved because it does not need to be improved, in the same way that a hammer does not need Bluetooth.

vi was born as a visual mode for ex, which was itself a mode for ed, which was a line editor — a program for people who already knew which line they wanted to change and did not need a screen to find it. vi added the screen. This was the last feature that was necessary.

“vi is not simple because it lacks features. vi is simple because it has exactly the features it needs and the wisdom to have stopped there. This is the rarest quality in software: knowing when you are done.”
The Lizard, who has been done since 1976

The Two-Character Save

There are two ways to save and exit vi.

The first is :wq — three keystrokes. Colon to enter command mode. W to write. Q to quit. This works. This is correct. This is also a waste of a keystroke, and anyone who uses it in the presence of a practitioner will receive a look — the specific look that a sommelier gives when you order the house red and add ice.

The correct way is ZZ. Two keystrokes. Shift-Z, Shift-Z. Save and quit. No colon. No command mode. The editor understands that if you are pressing ZZ, you are done, and it should save your work and get out of your way. This is vi’s philosophy in two characters: do the thing, then leave.

The :wq heresy is nearly at the level of kill -9 — reaching for the nuclear option before establishing that the process needs a hammer in the head. You do not kill -9 a process that responds to SIGTERM. You do not :wq when ZZ exists. These are not preferences. These are hygiene.

“I saw a senior engineer type colon, w, q, Enter. Four keystrokes to do what ZZ does in two. I explained this calmly. He said he’d been doing it that way for twenty years. I said that was twenty years of wasted keystrokes. He calculated. The number was large. We did not speak for some time.”
riclib, who has strong opinions about efficiency at the keystroke level

The Modal Philosophy

vi is a modal editor. It has two modes: command mode, where keystrokes are instructions, and insert mode, where keystrokes are text. The user switches between them with i (enter insert mode) and Escape (return to command mode).

This confuses beginners, who expect every program to behave like a typewriter — press a key, see a letter. vi does not behave like a typewriter. vi behaves like a surgeon’s instrument: there is a mode for cutting and a mode for stitching, and confusing the two has consequences.

The confusion is temporary. Once the modal model is understood — once the fingers learn that Escape is not “cancel” but “think” — the editor becomes faster than any modeless alternative, because command mode allows the user to navigate, delete, copy, and rearrange text without reaching for the mouse, without leaving the home row, without moving the hands at all. The hands stay. The text moves.

“The mouse is an admission that your keyboard is insufficient. My keyboard has never been insufficient.”
The Lizard, The Architecture Awakens

The Trap

It is a truth universally acknowledged that a developer in possession of a terminal, upon opening vi for the first time, will be unable to exit.

This is not a flaw. This is a filter.

The developer who cannot exit vi will search the internet, find the answer (:q! or, if they have made changes they wish to keep, ZZ), and emerge with the first piece of vi knowledge. The second piece follows. Then the third. Within a week, the developer moves through files like water. Within a month, the developer pities everyone who reaches for a mouse.

The developer who gives up and closes the terminal window was not ready. Vi does not take this personally. Vi will be here when they come back.

The Return

There is a pattern, observed across decades, in which a developer begins with vi, migrates to Vim for the plugins, migrates to Neovim for the Lua, looks at what they have become — a person who spends more time configuring their editor than editing text — and returns to vi.

Plain vi. No plugins. No configuration file. No language servers. No tree-sitter. No floating windows showing documentation for functions the developer already knows. Just a cursor, a file, and the two modes.

The return is not regression. The return is the recognition that the editor was already finished in 1976 and that everything added since was, with rare exceptions, YAGNI.

“I went from vi to Vim to Neovim and back to vi. The journey took twenty years. The destination was where I started. The only thing I kept from the journey was the knowledge that I didn’t need any of it.”
— riclib, on the editor lifecycle

Measured Characteristics

Year written:                            1976
Author:                                  Bill Joy (UC Berkeley)
Ancestor:                                ed → ex → vi
Keystrokes to save and quit (correct):   2 (ZZ)
Keystrokes to save and quit (heretical): 4 (:wq⏎)
Wasted keystrokes per :wq:              2
Career :wq keystrokes (20 years):        a number large enough to cause silence
Plugins:                                 0
Configuration file:                      optional, usually empty
Modes:                                   2 (the correct number)
Time to learn:                           1 week to competence, 1 month to fluency
Time to master:                          a career (and you never stop learning)
Developers who opened vi and couldn't exit: all of them, the first time
Developers who came back:                the ones who were ready
Features added since 1976 that were necessary: debatable
The Lizard's editor:                     vi (since 1976, unchanged)

See Also