
740
|
Chapter 9: The vi, ex, and vim Editors
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Address Symbols
See Chapter 7 for more information on using patterns.
Options
! Indicates a variant form of the command, overriding the normal behavior.
The ! must come immediately after the command.
count
The number of times the command is to be repeated. Unlike in vi commands,
count cannot precede the command, because a number preceding an ex
command is treated as a line address. For example, d3 deletes three lines
beginning with the current line; 3d deletes line 3.
file
The name of a file that is affected by the command. % stands for the current
file; # stands for the previous file.
Alphabetical Summary of ex Commands
ex commands can be entered by specifying any unique abbreviation. In this
listing, the full name appears in the margin, and the shortest possible abbrevia-
tion is used in the syntax line. Examples are assumed to be typed from vi, so they
include the : prompt.
Symbol Meaning
1,$ All lines in the file.
x,y Lines x through y.
x;y Lines x through y, with current line reset to x.
0 Top of file.
. Current line.
num Absolute line number num.
$ Last line.
% All lines; same as 1,$.
x-nn lines before x.
x+nn lines after x.
-[num] One or num lines previous.
+[num] One or num lines ahead.
'x Line marked with x.
'' Previous mark.
/pattern/ Forward to line ...