OpenWindows Advanced User's Guide

6.5.2 Inserting Text

vi provides many commands for inserting text. This section introduces you to the most useful of these commands. Note that each of these commands places vi in entry mode. To use any of these commands, you must first be in command mode. Remember to press Esc to make sure you are in command mode.

6.5.2.1 Append

Type a (append) to insert text to the right of the cursor. Experiment by moving the cursor anywhere on a line and typing a, followed by the text you want to add. Press Esc when you're finished.

Type A to add text to the end of a line. To see how this works, position the cursor anywhere on a text line and type A. The cursor will move to the end of the line, where you can type your additions. Press Esc when you're done.

6.5.2.2 Insert

Insert text to the left of the cursor by typing i from command mode.

Type I to insert text at the beginning of a line. (The command will move the cursor from any position on that line.) Again, as with all the commands in this section, press Esc to return to command mode after entering the desired text.

6.5.2.3 Open Line

Use these commands to open new lines, either above or below the current cursor position.

Type o to open a line below the current cursor position. To experiment, type o followed by a bit of text. You can enter several lines of text if you like. Press Esc when you are finished.

Type O to open a line above the current cursor position.