Ex commands ex syntax – I.R.I.S. DC1100 User Manual

Page 58

Advertising
background image

Coaxial Networks, Inc.

Page 58 of 60

ƒ

&

-- execute last ex-style substitution

ƒ

.

-- execute last modification

ƒ

!

object command -- send object as stdin to command and replace with

stdout

ƒ

[Ctrl]-G

-- print information about file

ƒ :

map

x y -- when character x is pressed, execute y

ƒ :

map!

x y -- map input mode character x to string y

ƒ :

ab

x y -- x is an abbreviation for y, changes are made on the fly

ƒ :

su

-- Suspend the current editor session

ƒ :

sh

-- run a shell

ƒ

ex Commands

ex
syntax

ex commands in the vi follow this general form:

: Address command

Which means:

Execute command on specific lines obtained from the address part of the general form.

If address is omitted, current line is used. Keep in mind that the ex is a line-based editor; so all
actions are line based.
Addresses

:

ƒ % -- all lines in file
ƒ x,y -- lines x to y
ƒ . -- current line
ƒ n -- line number: n
ƒ $ -- last line of file
ƒ x-n -- n lines before line x
ƒ x+n -- n lines after line x
ƒ /pat/ -- forward to line containing pat
ƒ ?pat? -- backward to line containing pat


Some commands are:

ƒ s/pat/text/ -- substitute 1

st

match of pat with text

ƒ s/pat/text/g -- substitute every match of pat with text
ƒ s/pat/text/n -- substitute the n

th

occurrence of pat with text

ƒ ya c -- yank into buffer c or the general buffer if c is omitted
ƒ g address cmd -- execute cmd on all lines which satisfy address
ƒ > -- shift right
ƒ < -- shift left
ƒ d -- delete line
ƒ ! UNIX-cmd -- execute UNIX-cmd on line
ƒ m address -- move lines to address

Advertising
This manual is related to the following products: