OpenWindows Advanced User's Guide

6.1 Starting vi

In the sub-sections that follow, you'll learn how to start vi, enter text in a file, save (write) the file, and quit vi. You'll also create a practice file that you'll use for the rest of this chapter.

6.1.1 Creating a File

Start vi and edit the file paint as shown in this example:

$ vi paint

If paint already exists, vi will open the existing file; if this is a new file, vi will create it. For the purposes of this example, paint should be a new file.

The vi editing screen appears in a moment:

Figure 6-1 The vi Editing Screen


The cursor appears in the upper left corner of the screen. Blank lines are indicated by a vertical series of tildes (~).

Note that you can also start vi without specifying a file name by just typing vi. You can then name the file later when you exit vi.

6.1.2 The Status Line

The last line of the screen, called the status line, shows the name of the file and the number of lines and characters in the file. When you create a new file, as is the case with our example, the status line indicates that it's a new file.