next up previous

3.1 Two Modes of the vi Editor

Before you begin working with the vi editor, you should know that there are two modes in vi - the command mode and the insert mode.

Command mode is used to move through text, search for words, save a file, etc. This mode covers everything except inserting code. Insert mode is only for inserting text into a file.

Using i, I, a, A, cw, o, O, or R will place you into insert mode from command mode.

These commands are described further here.

IMPORTANT!! Use the escape key to return to command mode from insert mode. If you are not sure which mode you are in, hit the escape key to be sure to be in command mode again.

If the keys you are pressing are not achieving the results they should, you may be in the wrong mode, or you may have accidentally pressed the Caps Lock key. The little green light on the Caps Lock key should not be lit (if such a light exists on your keyboard).