Learning the vi Editor

Learning the vi EditorSearch this book
Previous: 4.5 Other Advanced Edits Chapter 4
Beyond the Basics
Next: 5. Introducing the ex Editor
 

4.6 Review of vi Buffer and Marking Commands

Table 4.2 summarizes the command-line options common to all versions of vi. Table 4.3 and Table 4.4 summarize the buffer and marking commands.


Table 4.2: Command-Line Options
OptionMeaning
+n fileOpen file at line number n.
+fileOpen file at last line.
+/pattern fileOpen file at first occurrence of pattern.
-c command file

Run command after opening file; usually a line number or search (POSIX version of +).

-ROperate in read-only mode (same as using view instead of vi).
-rRecover files after a crash.

Table 4.3: Buffer Names
Buffer NamesBuffer Use
1-9The last nine deletions, from most to least recent.
a-z

Named buffers for you to use as needed. Uppercase letters append to the buffer.


Table 4.4: Buffer and Marking Commands
CommandMeaning
"bcommandDo command with buffer b.
mxMark current position with x.
'xMove cursor to first character of line marked by x.
`xMove cursor to character marked by x.
``Return to exact position of previous mark or context.
''Return to beginning of the line of previous mark or context.


Previous: 4.5 Other Advanced Edits Learning the vi EditorNext: 5. Introducing the ex Editor
4.5 Other Advanced Edits Book Index5. Introducing the ex Editor

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System