ex(1) ex(1)NAME e, ex, edit - text editor SYNOPSIS ex [-] [+command] [-r] [-R] [-t tag] [-v] [-x] name... e ex-arguments 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 line- based editing only. 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, which is used mostly by systems programmers and those very familiar with ed. e is synonymous with ex. 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 that focuses on the display editing portion of ex. The following flag options are recognized: - Suppresses all interactive-user feedback, as when pro- cessing 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 for recovery after an editor or system crash, re- trieving the last saved version of the named file. If no file is specified, a list of saved files will be re- ported. -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 de- April, 1990 1
ex(1) ex(1)faults to $, positioning the editor initially at the last line of the first file. Other useful commands here are scanning patterns of the form /pat or line numbers, for example, +100 to start at line 100. -x Encryption mode; a key is prompted for allowing crea- tion 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 :. The 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=CONTROL-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,$ 2 April, 1990
ex(1) ex(1)Initializing options EXINIT place set's here in environment variable $HOME/.exrc editor initialization file ./.exrc editor initialization file set x enable option set nox disable option 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 autoindent ai supply indent autowrite aw write before changing files ignorecase ic in scanning lisp lisp ( ) { } are s-exp's list list print CONTROL-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 CONTROL-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 FILES /usr/bin/e /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 April, 1990 3
ex(1) ex(1)/tmp/EXnnnnn editor temporary /tmp/Rxnnnnn named buffer temporary /usr/preserve preservation directory /usr/lib/tags standard editor tag file EXAMPLES The command 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), ``Using ex'' and ``Using vi'' in A/UX 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'' condi- tion, that is, 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 physi- cal 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 ap- pear in resultant files. 4 April, 1990