Solaris Advanced User's Guide

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.


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 command works, position the cursor anywhere on a text line and type A. The cursor moves to the end of the line, where you can type your additions. Press Esc when you are finished.


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 moves the cursor from any position on that line. Press Esc to return to command mode after you type the desired text.

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 type several lines of text if you like. Press Esc when you are finished.

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