DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing and editing

Entering text

To create a new file in vi, type vi filename, where filename is the name you want to call the new file. (You can edit any existing text file with vi by typing vi and then the name of that file.)

Inserting text with i or I

Appending text with a or A

Opening a line with o or O

Try writing a file with vi:

  1. Type cd and press <Enter> to go to your home directory.

  2. Type vi weekrep and press <Enter>. This opens up a file called weekrep and puts you into the vi editor with a blank file in front of you. You can see the name of the file at the bottom of the screen.

  3. Type i to go into insert mode.

  4. Type in the text shown in the following screen capture. Press <Enter> when you want to begin a new line. Do not worry if you make mistakes; you will learn how to correct these shortly.

  5. When you have finished typing, press <Esc> to go to command mode.

  6. In command mode, type : (colon). You should see a : prompt at the bottom of the screen.

  7. Type x and press <Enter> at the : prompt. When vi writes out the file, it shows you the number of lines and the number of characters.
    Weekly Report
    

    This week, I met with 5 of our 10 distributors. Everyone is eager to see the next release of our software, and they all expect to sell a lot of units in the coming quarter. ~ ~ ~    .    .    . "weekrep" [New file]


Next topic: Moving around in a file
Previous topic: Using the vi editor

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