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:
-
Type cd and press <Enter> to go to your home directory.
-
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.
-
Type i to go into insert mode.
-
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.
-
When you have finished typing, press <Esc> to go to command mode.
-
In command mode, type : (colon).
You should see a
:
prompt at the bottom of the screen.
-
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
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003