Chapter 7. The vi Editor


vi is the classic screen-editing program for Unix. A number of enhanced versions exist, including nvi , vim , vile , and elvis . On Mac OS X Tiger, the vi command is linked to vim . The Emacs editor, covered in Chapter 8, has several vi modes that allow you to use the same commands covered in this chapter.

The vi editor operates in two modes, command mode and insert mode . The dual mode makes vi an attractive editor for users who separate text entry from editing. For users who edit as they type, Emacs modeless editing can be more comfortable.

vi is based on an older line editor called ex . A user can invoke powerful editing capabilities within vi by typing a colon ( : ), entering an ex command, and pressing the Return 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 still an important part of vi , they are also described in this chapter.

One of the most common versions of vi is Bram Moolenaar's Vi IMproved, or vim . On Mac OS X Tiger, vim is the default version of vi and runs when you invoke vi . vim changes some of the basic features of vi , most notoriously changing the undo key to support multiple levels of undo. While seasoned users of vi find vim 's changes disturbing , those new to vi find vim 's extensive features attractive.

Wherever a command or option applies to vim only, those items are flagged in this chapter with ( vim ) after their description.


Fully documenting vim is beyond the scope of this chapter, but we do cover some of its most commonly used options and features. Beyond what we cover here, vim offers enhanced support to programmers through an integrated build and debugging process, syntax highlighting, extended ctags support, and support for Perl and Python, as well as GUI fonts and menus , function key mapping, independent mapping for each mode, and more. Fortunately, vim comes with a powerful help program you can use to learn more about the things we just couldn't fit into this chapter.

For more information, including details on vim 's extensions, see the O'Reilly book Learning the vi Editor .



MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net