vi Editor: Operating States vi operates in one of three basic states. When you start the edit session, you are in Visual state. From Visual state, the text insertion commands (e.g. the i command) causes vi to enter Insert state. From Visual state, you can enter Last-Line state to perform file read/write operations and search and substitute commands (plus other advanced operations). The following is a state diagram:
Visual state lets you move around and look at the file with the arrow keys or other keys. To put in new text or change old text you need to first enter Insert state.
To execute complicated commands such as string searches or repetitive string substitutions you must enter Last-Line state by typing a colon (:), a slash (/) or a question mark (?). When you enter Last-Line state, a colon prompt appears at the last line of the screen and the cursor is placed at that line ready for you to type the special command.