9.3. Review of vi OperationsThis section provides a review of the following:
9.3.1. Command ModeOnce the file is opened, you are in command mode. From command mode, you can:
9.3.2. Insert ModeIn insert mode, you can enter new text in the file. You normally enter insert mode with the i command. Press the Escape key to exit insert mode and return to command mode. The full list of commands that enter insert mode is provided later, in the section Insert Commands." 9.3.4. Syntax of vi CommandsIn vi, editing commands have the following general form: [n] operator[m] motion The basic editing operators are:
If the current line is the object of the operation, the motion is the same as the operator: cc, dd, yy. Otherwise, the editing operators act on objects specified by cursor-movement commands or pattern-matching commands. (For example, cf. changes up to the next period.) n and m are the number of times the operation is performed, or the number of objects the operation is performed on. If both n and m are specified, the effect is n x m. An object of operation can be any of the following text blocks:
9.3.4.1 Examples
More commands and examples may be found in the section Changing and Deleting Text," later in this chapter 9.3.4.2 Visual mode (vim only)vim provides an additional facility, "visual mode." This allows you to highlight blocks of text which then become the object of edit commands such as deletion or saving (yanking). Graphical versions of vim allow you to use the mouse to highlight text in a similar fashion. See the vim help file visual.txt for the full story.
9.3.5. Status-Line CommandsMost commands are not echoed on the screen as you input them. However, the status line at the bottom of the screen is used to edit these commands:
Commands that are entered on the status line must be entered by pressing the Enter key. In addition, error messages and output from the Ctrl-G command are displayed on the status line. |