文档介绍: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 monly
available, and are ing 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'e standard with mercial UNIX systems; you must retrieve and install it yourself.
To many beginners, vi looks unintuitive and cumbersome—instead
of using special control keys for word processing functions and just
letting you type normally, it uses all of the regular keyboard keys
for mands. When the keyboard keys are issuing
commands, vi is said to be mand mode. You must be in a
special insert mode before you can type actual text on the screen.
In a