Book HomeLearning the vi EditorSearch this book

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

Option Meaning
+n file Open file at line number n.
+file Open file at last line.
+/pattern file Open file at first occurrence of pattern.
-c command file

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

-R Operate in read-only mode (same as using view instead of vi).
-r Recover files after a crash.

Table 4.3. Buffer Names

Buffer Names Buffer Use
1-9 The 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

Command Meaning
"bcommand Do command with buffer b.
mx Mark current position with x.
'x Move cursor to first character of line marked by x.
`x Move 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.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.