Chapter 1. The vi Text Editor

UNIX has a number of editors that can process the contents of text files, whether those files contain data, source code, or sentences. There are line editors, such as ed and ex, which display a line of the file on the screen; and there are screen editors, such as vi and emacs, which display a part of the file on your terminal screen. Text editors based on the X Window System are also commonly available, and are becoming increasing popular. Both GNU emacs and its derivative xemacs provide multiple X windows; an interesting alternative is the sam editor from Bell Labs. All but one of the vi clones described in Part II of this book also provide X-based interfaces.

vi is the most useful standard text editor on your system. (vi is short for visual editor and is pronounced "vee-eye.") Unlike emacs, it is available in nearly identical form on almost every UNIX system, thus providing a kind of text-editing lingua franca.[1] The same might be said of ed and ex, but screen editors are generally much easier to use. With a screen editor, you can scroll the page, move the cursor, delete lines, insert characters, and more, while seeing the results of your edits as you make them. Screen editors are very popular, since they allow you to make changes as you read through a file, like you would edit a printed copy, only faster.

[1] Actually, these days, GNU emacs is pretty much the universal version of emacs; the only problem is it doesn't come standard with ...

Get Learning the vi Editor, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.