ex(1) ex(1)
NAME
ex, edit - text editor
SYNOPSIS
ex [-] [+command] [-r] [-R] [-t tag] [-v] [-x] name ...
edit [-] [+command] [-r] [-R] [-t tag] [-v] [-x] name ...
DESCRIPTION
ex is the root of a family of editors: edit, ex and vi. The
edit command set is a subset of the ex set, including just
the basic commands, fewer magic characters, and only
line-based editing. Display-based editing is the focus of
vi.
If you have not used ed, or are a casual user, you will find
that the editor edit is convenient for you. It avoids some
of the complexities of ex used mostly by systems programmers
and persons very familiar with ed.
If you have a CRT terminal, you may wish to use a
display-based editor; in this case see vi(1), which is a
command which focuses on the display editing portion of ex.
The following flag options are recognized:
- Suppresses all interactive-user feedback, as when
processing editor scripts in command files.
-v Equivalent to using vi rather than ex.
-t tag
Equivalent to an initial tag command, editing the file
containing the tag and positioning the editor at its
definition.
-rfile
Used in recovering after an editor or system crash,
retrieving the last saved version of the named file.
If no file is specified, a list of saved files will be
reported.
-R Read-only mode set, prevents accidentally overwriting
the file.
+command
Indicates that the editor should begin by executing the
specified command. If command is omitted, then it
defaults to $, positioning the editor at the last line
of the first file initially. Other useful commands
here are scanning patterns of the form /pat or line
numbers, e.g., +100 to start at line 100.
Page 1 (last mod. 1/16/87)
ex(1) ex(1)
-x Encryption mode; a key is prompted for allowing
creation or editing of an encrypted file. This
encryption scheme is not secure.
name Indicates files to be edited.
Modes
Command Normal and initial state. Input prompted for
by :. Your kill character cancels partial
command.
Insert Entered by a i and c. Arbitrary text may be
entered. Insert is normally terminated by
line having only . on it, or abnormally with
an interrupt.
Visual Entered by vi, terminates with Q or ^\.
Command Names and Abbreviations
abbrev ab next n undo u
append a number nu unmap unm
args ar preserve pre version ve
change c print p visual vi
copy co put pu write w
delete d quit q xit x
edit e read re yank ya
file f recover rec window z
global g rewind rew escape !
insert i set se lshift <
join j shell sh printnext CR
list l source so resubst &
map map stop st rshift >
mark ma substitute s scroll ^D
move m unabbrev una
where CR=RETURN, and ^D=.ft3 -d .
Command Addresses
n line n /pat next with pat
. current ?pat previous with pat
$ last x-n n before x
+ next x,y x through y
- previous 'x marked with x
+n n forward '' previous context
% 1,$
Initializing options
EXINIT place set's here in environment var.
$HOME/.exrc editor initialization file
./.exrc editor initialization file
set x enable option
set nox disable option
Page 2 (last mod. 1/16/87)
ex(1) ex(1)
set x=val give value val
set show changed options
set all show all options
set x? show value of option x
Most useful options
240.it1 }N
-i for TAB, $ at end
552.it1 }N
-d
autoindent ai supply indent
autowrite aw write before changing files
ignorecase ic in scanning
lisp lisp ( ) { } are s-exp's
list list print .ft3
-i for TAB, $ at end
magic magic .[ * special in patterns
number nu number lines
paragraphs para macro names which start . . .
redraw redraw simulate smart terminal
scroll scroll command mode lines
sections sect macro names
shiftwidth sw for < >, and input .ft3
-d
showmatch sm to ) and } as typed
showmode smd show insert mode in vi
slowopen slow stop updates during insert
window window visual mode lines
wrapscan ws around end of buffer?
wrapmargin wm automatic line splitting
Scanning pattern formation
^ beginning of line
$ end of line
. any character
\< beginning of word
\> end of word
[str] any char in str
[↑str] . . . not in str
[x-y] . . . between x and y
* any number of preceding
/usr/bin/ex
/usr/bin/edit
/usr/lib/ex3.9strings
error messages
/usr/lib/ex3.9recover
recover command
/usr/lib/ex3.9preserve
preserve command
/usr/lib/*/* describes capabilities of terminals
~/.exrc editor startup command file, user-
created in home directory
Page 3 (last mod. 1/16/87)
ex(1) ex(1)
/tmp/EXnnnnn editor temporary
/tmp/Rxnnnnn named buffer temporary
/usr/preserve preservation directory
/usr/lib/tags standard editor tag file
EXAMPLE
ex text
would invoke the editor with the file named text.
SEE ALSO
awk(1), ed(1), grep(1), sed(1), vi(1), curses(3X), term(4),
terminfo(4),
``ex Reference'' and ``Using vi'' in Oreo Text Editing
Tools.
BUGS
The undo (u) command causes all marks to be lost on lines
changed and then restored if the marked lines were changed.
The undo command never clears the ``buffer modified''
condition, i.e., once the editor buffer has been modified,
ex tells you that it is [Modified], even if you undo the
only modification.
The z command prints a number of logical rather than
physical lines. More than a screen full of output may
result if long lines are present.
File input/output errors don't print a name if the command
line - option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn if text is placed in named buffers
and not used before exiting the editor.
Null characters are discarded in input files, and cannot
appear in resultant files.
Page 4 (last mod. 1/16/87)