Writing and editing

Using the vi editor

vi is the standard text editor on the UNIX system. vi is a text editor, not a word processor. It has many powerful features for manipulating text (deleting, moving, searching, replacing, and so on), but it does not, for example, allow you to change line spacing or make letters boldface or italic.

In this tutorial, you will be learning the basics of vi. A summary of vi commands appears at the back of this book. To appreciate fully the power of this UNIX system tool, you should read ``Editing files'' and look at vi(C).

The name vi comes from the word ``visual.'' Different from its predecessors ex and ed, vi shows a full screen of the file at once. (ed and ex are similar to edlin on DOS; you tell them what you want to do without actually seeing the file in front of you.)

vi works in two modes. When you first start vi, you are in command mode -- vi is waiting for you to give it a command. When you give the command i (insert), you change into insert mode. From then on, what you type is inserted into the file. To leave insert mode and return to command mode, press the <Esc> key. To exit vi, give it the command :x (you need to press <Esc> first if you are not in command mode). This saves the file if you made any changes.

Next topic: Entering text
Previous topic: Looking at files

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005