z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Adding text

z/OS UNIX System Services User's Guide
SA23-2279-00

The simplest action you can perform is adding text to what is already on the screen. Move the cursor to the blank line following:
And frightened Miss Muffet away.
The cursor should be at the first position in the blank line. Now type a. Because you are in Command Mode, this is taken to be a command, not text. The a command tells vi to begin adding to the text that is already on the screen. If you now type:
Little Boy Blue
you can see the characters appear on the line. The a command switches from Command Mode to Insert Mode. You can now see what you are typing.
Press <Enter> at the end of the line. The bottom part of the screen moves down to make a new blank line after the line you were typing. Keep typing more lines:
Come blow your horn
The sheep's in the meadow,
The cow's in the corn.
You see that the bottom part of the screen keeps moving down to make more room for what you are typing. After the a command, the text that you type is added into the middle of existing text.

When you have typed the last line, press <Enter> to make a new blank line, then press <Esc>. <Esc>switches from Insert Mode back to Command Mode. Now, vi interprets what you type as commands again. If you type 4 followed by , the cursor moves up four lines to the beginning of the text you just typed in. The 4 does not appear on the screen when you type it, because command input is not usually displayed.

Move the cursor to the B at the beginning of the word Blue in the text you have just typed. Press a to add more text, then type the letter l. The l is added after the B and the rest of the text on the line moves over to make room for the new character. This shows that a adds text after the current cursor position.

Press <Backspace>. The cursor backs up one space. Press <Esc>to return to Command Mode. The l disappears when you leave Insert Mode, and vi adjusts the screen to get rid of characters deleted by backspacing.

The Little Boy Blue rhyme that you have just added to the file follows the previous nursery rhyme immediately. The file would look better with a blank line separating the two rhymes. Figure out how to put in this blank line, and do it.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014