Next: 3.12.2 Starting vi Up: 3.12 Using the vi Previous: 3.12 Using the vi

## 3.12.1 Concepts

While using `vi`, at any one time you are in one of three modes of operation. These modes are known as command mode, insert mode, and last line mode.

When you start up `vi`, you are in command mode. This mode allows you to use certain commands to edit files or to change to other modes. For example, typing ```x`'' while in command mode deletes the character underneath the cursor. The arrow keys move the cursor around the file which you're editing. Generally, the commands used in command mode are one or two characters long.

You actually insert or edit text within insert mode. When using `vi`, you'll probably spend most of your time within this mode. You start insert mode by using a command such as ```i`'' (for ``insert'') from command mode. While in insert mode, you are inserting text into the document from your current cursor location. To end insert mode and return to command mode, press .

Last line mode is a special mode used to give certain extended commands to `vi`. While typing these commands, they appear on the last line of the screen (hence the name). For example, when you type ```:`'' from command mode, you jump into last line mode, and can use commands such as ```wq`'' (to write the file and quit `vi`), or ```q!`'' (to quit `vi` without saving changes). Last line mode is generally used for `vi` commands which are longer than one character. In last line mode, you enter a single-line command and press to execute it.

Next: 3.12.2 Starting vi Up: 3.12 Using the vi Previous: 3.12 Using the vi