Section 7.13. Syntax of ex Commands

7.13. 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 . options and addresses are described in the following sections. ex commands are described in "Syntax of ex commands."

7.13.1. Options



!

Indicates a variant command form, overriding the normal behavior.



count

The number of times the command is to be repeated. Unlike vi commands, the count comes after the command , not before it. Numbers preceding an ex command are considered to be part of the address . For example, 3d deletes line 3, while d3 deletes three 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.

7.13.2. 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 .

7.13.3. Address Symbols

Symbol

Meaning

1,$

All lines in the file

%

All lines; same as 1,$

x , y

Lines x tHRough y

x ; y

Lines x through y , with current line reset to x

Top of file

.

Current line

n

Absolute line number n

$

Last line

x - n

n lines before x

x + n

n lines after x

-[ n ]

One or n lines previous

+[ n ]

One or n lines ahead

' x

Line marked with x

"

Previous mark

/ pattern /

Forward to line matching pattern

? pattern ?

Backward to line matching pattern




MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net