
Command-Line Syntax | 721
vi
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
The vi editor operates in two modes: command mode and insert mode. The dual
modes make vi an attractive editor for users who separate text entry from editing.
For users who edit as they type, the modeless editing of Emacs can be more
comfortable. However, vim supports both ways of editing, through the insert-
mode option.
vi is based on an older line editor called ex.(ex, in turn, was developed by Bill Joy
at the University of California, Berkeley, from the primordial Unix line editor, ed.)
A user can invoke powerful editing capabilities within vi by typing a colon (:),
entering an ex command, and pressing the Enter key. Furthermore, you can place
ex commands in a startup file called ~/.exrc, which vi reads at the beginning of
your editing session. Because ex commands are such an important part of vi, they
are also described in this chapter.
One of the most common versions of vi found on Linux systems is Bram
Moolenaar’s Vi IMproved, or vim. On some Linux distributions, vim is the
default version of vi and runs when you invoke vi. vim offers many extra features,
and optionally changes some of the basic features of vi, most notoriously
changing the undo key to support multiple levels of undo.
Fully documenting vim is beyond the scope of this chapter, but we do ...