VI (1976) → VIM (1991): A REAL, TINY EMULATOR

vi was written by Bill Joy in 1976 for BSD Unix, for a world of slow serial terminals where every keystroke sent over the wire was expensive — hence a language of single-letter commands and no menus. Vim ("Vi IMproved") followed in 1991 and is still, thirty-plus years later, what half the internet's servers get edited with over SSH. The best way to learn it isn't to read about it — it's to type into it. Below is a small but real modal editor, implemented in JavaScript, with six guided lessons.

Lesson

NORMAL

Click the black terminal above, then type. It captures your keyboard the way a real terminal window would — click elsewhere (or press Esc then Tab) to escape it.


CHEAT SHEET (what this emulator supports)

Key(s)ModeEffect
h j k lNormalmove left / down / up / right
0 / $Normaljump to start / end of line
gg / GNormaljump to first / last line
i / aNormalinsert before / after cursor → INSERT mode
I / ANormalinsert at start / end of line
o / ONormalopen new line below / above → INSERT mode
xNormaldelete the character under the cursor
ddNormaldelete (cut) the current line
yyNormalyank (copy) the current line
pNormalpaste after the current line
VNormalenter VISUAL LINE mode (select whole lines with j/k)
d / yVisual linedelete / yank the selected lines
EscInsert / Visualback to NORMAL mode
:Normalenter COMMAND-LINE mode (bottom of screen)
:w :q :wqCommand-linewrite / quit / write-and-quit (simulated)

See also: 1959 LISP console (prefix / Polish notation) · 1970 FORTH terminal (postfix / RPN) · 1985 dial-up BBS · 1993 Mosaic homepage · 1991 Gopher menu · return to the surface (WWW homepage)