Enter | Move to the start of the next line. |
Home, ^, |, or 0 (Zero) | Move to the start of the line. |
End, $ | Move to the end of the line. |
: | Move to line |
:0 Enter | Move to the start of the file. |
:$ | Move to the end of the file. |
w | Move forward one word. |
You can put a number in front of any command to repeat the command. For example, typing 10j will move down 10 lines.
4.4.1.3. Inserting text
There are several commands for inserting text, as shown in Table 4-8 .
Table 4-8. Commands to enter insert mode
Command | Description |
---|---|
i | Insert before the cursor. |
I | Insert at the start of the line. |
a | Append after the cursor. |
A | Append at the end of the line. |
o | Open a line after the current line and insert text. |
O | Open a line before the current line and insert text. |
All of these commands place the editor into insert mode; the only difference is where the cursor is positioned for the inserted text. The word -- INSERT -- will appear in the lower-left corner of the display.
To exit from insert mode and return to normal mode, press Esc. The -- INSERT -- indicator in the lower- left corner of the display will disappear.
4.4.1.4. Deleting, yanking, and putting: vi's version of cutting, copying, and pasting
Table 4-9. Basic delete and yank commands
Command | Description | Examples |
---|---|---|
x | Delete one character to the right of the cursor. | x deletes one character to the right of the cursor; 25x deletes the character at the cursor position and 24 characters to the right. |
X | Delete one character to the left of the cursor. | X deletes one character to the left of the cursor; 19X deletes 19 characters to the left. |