Syntax of ex Commands
To enter an ex
command from vi
, type:
:[address
]command
[options
]
An initial : indicates an ex
command. As you
type the command, it is echoed on the status line. Enter the command
by pressing Return. address
is the line
number or range of lines that are the object of
command
.
option
s and
addresse
s are described in the following
sections. ex
commands are described in Section 23.14.
Options
-
!
Indicates a variant command form, overriding the normal behavior.
-
count
The number of times the command is to be repeated. Unlike
vi
commands, thecount
comes after the command, not before it. Numbers preceding anex
command are considered to be part of theaddress
. For example,3d
deletes line 3;d3
deletes 3 lines beginning with the current line.-
file
The name of a file that is affected by the command.
%
stands for current file;#
stands for previous file.
Addresses
If no address is given, the current line is the object of the command. If the address specifies a range of lines, the format is:
x,y
where x
and y
are the first and last addressed lines (x
must precede y
in the buffer).
x
and y
may be
line numbers or symbols. Using ; instead of , sets the current line
to x
before interpreting
y
.
Address Symbols
Symbol |
Meaning |
---|---|
|
All lines in the file |
|
All lines; same as |
|
Lines |
|
Lines |
|
Top of file |
. |
Current line |
|
Absolute line number |
|
Last line |
|
|
Get Mac OS X Panther in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.