| To go into editing mode |
| a (once) |
For "append". Puts you in insert (or "editing") mode. Any characters that you type subsequently will be added to your file to the right of your cursor. |
| i (once) |
For "insert". Puts you in editing mode (if you are in command mode); characters that you type subsequently will be inserted to the left of your cursor. |
<Return> |
Return key. Starts a new line (if you are in editing mode). |
<Esc> |
Esc key. Takes you out of insert (or "editing") mode and returns you to command mode. |
| Use these when in command mode |
| h (or ←) |
Moves your cursor one character to the left. |
| j (or ↓) |
Moves your cursor down one line. |
| k (or ↑) |
Moves your cursor up one line. |
| l (or →) |
Moves your cursor one character to the right. |
| ^f |
Scroll forward one screenful. |
| ^b |
Scroll backward one screenful. |
| x |
Deletes the character on which your cursor lies. |
| dd |
Deletes the current line. |
| u |
Undoes your last command. |
| J |
Joins the next line with the current line. |
| ZZ |
Save your work and quit vi. |
:w <Return> |
Writes (saves) your changes. (Typed sequentially.) |
:wq <Return> |
Saves your changes and quits vi. (Typed sequentially.) |
:q! <Return> |
Quits vi without saving your changes. (Typed sequentially.) |