vi (pronounced "vee-eye") is the classic visual text editor of Unix, written by Bill Joy at Berkeley in 1976. It was a major advance over the line-oriented ed editor: a full-screen, modal editor that let you navigate and edit with single-key commands. vi became the de facto standard editor of BSD and was later standardised by POSIX, meaning some implementation of vi is available on almost every Unix-like system.
vi is modal: it has distinct modes for inserting text (i, a, o) and for navigating and manipulating it (normal mode, the default). This is unusual—modern editors are usually modeless—but modal editing is extraordinarily efficient once mastered, because you spend most of your time in normal mode where every key is a command.
Basic survival commands:
i insert before cursor
Esc return to normal mode
:w write (save)
:q quit
:wq write and quit
:q! quit without saving
dd delete line
yy yank (copy) line
p paste
/text search forward
On most modern Linux systems, vi is a symlink or alternative pointing to Vim (Vi IMproved), a drop-in replacement with syntax highlighting, undo, and plug-ins. Pure vi is rare outside of minimal systems like Alpine and BusyBox.
Discussed in:
- Chapter 15: Editors: vi, Vim, and Nano — vi: The Universal Editor
Also defined in: Textbook of Linux