Next: Entering vi editor Up: The vi editor Previous: History

Modes of operation

There is two major modes in ex editor. These are

Since you will use the vi mode in this course, we will skip the command and input modes of ex. All you have to know is that you can alternate between ex and vi with the following commands.

There are three modes of operation in vi.

While in command mode, vi accepts keystrokes as commands. Each key you press is recognized as a command. If you press the Q key in command mode, it will take you to ex editor. In input mode, vi accepts keystrokes as text, displaying the text as you enter it. All commands that start with colon ':' put vi in last line mode. The colon moves the cursor to the bottom line of the screen here you enter the rest of the command.

The main difference between the command mode and last line mode is that, each key you press can mean a different command in command mode. But the last line mode waits until you finish the command and press enter (like giving a command in prompt). Until enter is pressed the keys you press will appear in last line, and you can move back with backspace key. In command mode, a single key stroke has a meaning, and is executed at that instant. You do not press the enter key after finishing the command.

When you enter the vi, it opens in command mode. Several commands like insert and append puts you in insert mode. The escape key will always put you back to the command mode.

You can only write text or come one character back with backspace key in input mode. Do not use the arrow keys to move up, down, right or left when you are in insert mode. To go to a specific character on the text, first you have to enter command mode, then use the movement commands or cursor keys.


\begin{figure}

\epsfig {figure=images/vi_modes.eps}
\end{figure}

The commands in this manual are limited to practical use. To learn other commands and shortcuts, please refer to reference book for vi.



Next: Entering vi editor Up: The vi editor Previous: History