








                       EExx RReeffeerreennccee MMaannuuaall
                           VVeerrssiioonn 33..77


                           _W_i_l_l_i_a_m _J_o_y
                           _M_a_r_k _H_o_r_t_o_n
                    Computer Science Division
    Department of Electrical Engineering and Computer Science
               University of California, Berkeley
                      Berkeley, Ca.  94720


                            _A_B_S_T_R_A_C_T

          _E_x  a  line  oriented  text editor, which supports
     both command and display oriented editing.  This refer-
     ence  manual describes the command oriented part of _e_x_;
     the display editing features of _e_x are described in  _A_n
     _I_n_t_r_o_d_u_c_t_i_o_n  _t_o  _D_i_s_p_l_a_y _E_d_i_t_i_n_g _w_i_t_h _V_i_.  Other docu-
     ments about the editor include the introduction _E_d_i_t_: _A
     _t_u_t_o_r_i_a_l,  the  _E_x_/_e_d_i_t _C_o_m_m_a_n_d _S_u_m_m_a_r_y, and a _V_i _Q_u_i_c_k
     _R_e_f_e_r_e_n_c_e card.


11..  SSttaarrttiinngg eexx

     Each instance of the editor has a set of options, which  can
be  set  to tailor it to your liking.  The command _e_d_i_t invokes a
version of _e_x designed for more  casual  or  beginning  users  by
changing  the default settings of some of these options.  To sim-
plify the description which follows we assume  the  default  set-
tings of the options.

     When  invoked, _e_x determines the terminal type from the TERM
variable in the environment.  It there is a TERMCAP  variable  in
the  environment,  and  the  type of the terminal described there
matches the TERM variable, then that description is  used.   Also
if  the TERMCAP variable contains a pathname (beginning with a //)
then the editor will seek the description of the terminal in that
file (rather than the default /etc/termcap).  If there is a vari-
able EXINIT in the environment, then the editor will execute  the
commands  in that variable, otherwise if there is a file _._e_x_r_c in
your HOME directory _e_x reads commands from that file,  simulating
a  _s_o_u_r_c_e  command.   Option setting commands placed in EXINIT or
_._e_x_r_c will be executed before each editor session.


-----------
The financial support of  an  IBM  Graduate  Fellowship  and  the
National  Science  Foundation  under  grants  MCS74-07644-A03 and
MCS78-07291 is gratefully acknowledged.









USD:12-2                                      Ex Reference Manual


     A command to enter _e_x has the following prototype:

     eexx [ -- ] [ --vv ] [ --tt _t_a_g ] [ --rr ] [ --ll ] [ --ww_n ] [ --xx ] [ --RR ] [ ++_c_o_m_m_a_n_d ] name ...

The most common case edits a single file with no options, i.e.:

     eexx name

The -- command line option option suppresses all  interactive-user
feedback  and  is  useful in processing editor scripts in command
files.  The --vv option is equivalent to using _v_i rather  than  _e_x_.
The  --tt  option  is equivalent to an initial _t_a_g command, editing
the file containing the _t_a_g and positioning  the  editor  at  its
definition.   The --rr option is used in recovering after an editor
or system crash, retrieving the last saved version of  the  named
file  or,  if no file is specified, typing a list of saved files.
The --ll option sets up for editing LISP, setting the _s_h_o_w_m_a_t_c_h and
_l_i_s_p  options.   The --ww option sets the default window size to _n_,
and is useful on dialups to  start  in  small  windows.   The  --xx
option  causes  _e_x  to prompt for a _k_e_y, which is used to encrypt
and decrypt the contents of the file,  which  should  already  be
encrypted  using  the same key, see _c_r_y_p_t(1).  The --RR option sets
the _r_e_a_d_o_n_l_y option at the start.  _N_a_m_e arguments indicate  files
to  be  edited.   An argument of the form ++_c_o_m_m_a_n_d indicates that
the editor should begin by executing the specified  command.   If
_c_o_m_m_a_n_d  is  omitted,  then it defaults to ``$'', positioning the
editor at the last line of the first file initially.  Other  use-
ful  commands  here are scanning patterns of the form ``/pat'' or
line numbers, e.g. ``+100'' starting at line 100.

22..  FFiillee mmaanniippuullaattiioonn

22..11..  CCuurrrreenntt ffiillee

     _E_x is normally editing the contents of a single file,  whose
name is recorded in the _c_u_r_r_e_n_t file name.  _E_x performs all edit-
ing actions in a buffer (actually a temporary  file)  into  which
the  text  of  the  file  is initially read.  Changes made to the
buffer have no effect on the file being edited unless  and  until
the buffer contents are written out to the file with a _w_r_i_t_e com-
mand.  After the buffer contents are written, the  previous  con-
tents  of the written file are no longer accessible.  When a file
is edited, its name becomes the current file name, and  its  con-
tents are read into the buffer.

     The  current  file is almost always considered to be _e_d_i_t_e_d_.
This means that the contents of the  buffer  are  logically  con-
nected  with  the  current file name, so that writing the current
buffer contents onto that file, even if it exists, is  a  reason-
able  action.  If the current file is not _e_d_i_t_e_d then _e_x will not
normally write on it if it already exists.*
-----------
 Brackets `[' `]' surround optional parameters here.
* The _f_i_l_e command will say ``[Not edited]'' if the current  file









Ex Reference Manual                                      USD:12-3


22..22..  AAlltteerrnnaattee ffiillee

     Each time a new value is given to the current file name, the
previous current file name is saved as the _a_l_t_e_r_n_a_t_e  file  name.
Similarly  if a file is mentioned but does not become the current
file, it is saved as the alternate file name.

22..33..  FFiilleennaammee eexxppaannssiioonn

     Filenames within the editor may be specified using the  nor-
mal  shell expansion conventions.  In addition, the character `%'
in filenames is replaced by the _c_u_r_r_e_n_t file name and the charac-
ter `#' by the _a_l_t_e_r_n_a_t_e file name.

22..44..  MMuullttiippllee ffiilleess aanndd nnaammeedd bbuuffffeerrss

     If more than one file is given on the command line, then the
first file is edited as described above.  The remaining arguments
are placed with the first file in the _a_r_g_u_m_e_n_t _l_i_s_t_.  The current
argument list may be displayed with the _a_r_g_s command.   The  next
file  in  the  argument list may be edited with the _n_e_x_t command.
The argument list may also be respecified by specifying a list of
names to the _n_e_x_t command.  These names are expanded, the result-
ing list of names becomes the new argument list, and _e_x edits the
first file on the list.

     For saving blocks of text while editing, and especially when
editing more than one file, _e_x has  a  group  of  named  buffers.
These  are  similar to the normal buffer, except that only a lim-
ited number of operations are available  on  them.   The  buffers
have names _a through _z_.

22..55..  RReeaadd oonnllyy

     It  is possible to use _e_x in _r_e_a_d _o_n_l_y mode to look at files
that you have no intention of modifying.  This mode protects  you
from  accidently overwriting the file.  Read only mode is on when
the _r_e_a_d_o_n_l_y option is set.  It can be turned on with the --RR com-
mand line option, by the _v_i_e_w command line invocation, or by set-
ting the _r_e_a_d_o_n_l_y option.  It can be cleared by  setting  _n_o_r_e_a_d_-
_o_n_l_y.   It is possible to write, even while in read only mode, by
indicating that you really know what  you  are  doing.   You  can
write  to  a different file, or can use the ! form of write, even
while in read only mode.


-----------
is not considered edited.
 This makes it easy to deal alternately with two files and elimi-
nates the need for retyping the name supplied on an _e_d_i_t  command
after a _N_o _w_r_i_t_e _s_i_n_c_e _l_a_s_t _c_h_a_n_g_e diagnostic is received.
  It  is  also  possible  to refer to _A through _Z_; the upper case
buffers are the same as the lower but commands  append  to  named
buffers rather than replacing if upper case names are used.









USD:12-4                                      Ex Reference Manual


33..  EExxcceeppttiioonnaall CCoonnddiittiioonnss

33..11..  EErrrroorrss aanndd iinntteerrrruuppttss

     When errors occur _e_x (optionally) rings  the  terminal  bell
and,  in  any  case,  prints an error diagnostic.  If the primary
input is from a file, editor processing will  terminate.   If  an
interrupt signal is received, _e_x prints ``Interrupt'' and returns
to its command level.  If the primary input is a  file,  then  _e_x
will exit when this occurs.

33..22..  RReeccoovveerriinngg ffrroomm hhaanngguuppss aanndd ccrraasshheess

     If a hangup signal is received and the buffer has been modi-
fied since it was last written out, or  if  the  system  crashes,
either  the  editor  (in  the first case) or the system (after it
reboots in the second) will attempt to preserve the buffer.   The
next  time  you log in you should be able to recover the work you
were doing, losing at most a few lines of changes from  the  last
point  before  the hangup or editor crash.  To recover a file you
can use the --rr option.  If you were editing the file _r_e_s_u_m_e_, then
you  should change to the directory where you were when the crash
occurred, giving the command

     eexx --rr _r_e_s_u_m_e

After checking that the retrieved file  is  indeed  ok,  you  can
_w_r_i_t_e it over the previous contents of that file.

     You  will normally get mail from the system telling you when
a file has been saved after a crash.  The command

     eexx -rr

will print a list of the files which have  been  saved  for  you.
(In  the  case of a hangup, the file will not appear in the list,
although it can be recovered.)

44..  EEddiittiinngg mmooddeess

     _E_x has five distinct modes.  The  primary  mode  is  _c_o_m_m_a_n_d
mode.   Commands are entered in command mode when a `:' prompt is
present, and are executed each time a complete line is sent.   In
_t_e_x_t  _i_n_p_u_t  mode  _e_x  gathers input lines and places them in the
file.  The _a_p_p_e_n_d_, _i_n_s_e_r_t_, and _c_h_a_n_g_e  commands  use  text  input
mode.   No  prompt  is  printed  when you are in text input mode.
This mode is left by typing a `.' alone at  the  beginning  of  a
line, and _c_o_m_m_a_n_d mode resumes.

     The  last  three modes are _o_p_e_n and _v_i_s_u_a_l modes, entered by
the commands of the same name, and, within open and visual  modes
_t_e_x_t  _i_n_s_e_r_t_i_o_n  mode.  _O_p_e_n and _v_i_s_u_a_l modes allow local editing
operations to be performed on the text in  the  file.   The  _o_p_e_n
command  displays one line at a time on any terminal while _v_i_s_u_a_l









Ex Reference Manual                                      USD:12-5


works on CRT terminals with random positioning cursors, using the
screen  as  a  (single)  window  for file editing changes.  These
modes are described (only) in _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _D_i_s_p_l_a_y  _E_d_i_t_i_n_g
_w_i_t_h _V_i_.

55..  CCoommmmaanndd ssttrruuccttuurree

     Most  command  names are English words, and initial prefixes
of the words are  acceptable  abbreviations.   The  ambiguity  of
abbreviations is resolved in favor of the more commonly used com-
mands.*

55..11..  CCoommmmaanndd ppaarraammeetteerrss

     Most commands accept prefix addresses specifying  the  lines
in  the  file  upon  which they are to have effect.  The forms of
these addresses will be discussed below.  A  number  of  commands
also  may take a trailing _c_o_u_n_t specifying the number of lines to
be involved in the command.  Thus the command ``10p'' will  print
the  tenth line in the buffer while ``delete 5'' will delete five
lines from the buffer, starting with the current line.

     Some commands take other  information  or  parameters,  this
information always being given after the command name.

55..22..  CCoommmmaanndd vvaarriiaannttss

     A number of commands have two distinct variants.  The  vari-
ant  form of the command is invoked by placing an `!' immediately
after the command name.  Some of the default variants may be con-
trolled  by  options;  in this case, the `!' serves to toggle the
default.

55..33..  FFllaaggss aafftteerr ccoommmmaannddss

     The characters `#', `p' and `l' may  be  placed  after  many
commands.**  In this case, the command abbreviated by these char-
acters  is  executed  after the command completes.  Since _e_x nor-
mally prints the new current  line  after  each  change,  `p'  is
rarely  necessary.   Any number of `+' or `-' characters may also
be given with these flags.  If they appear, the specified  offset
is  applied to the current line value before the printing command
is executed.
-----------
* As an example, the command _s_u_b_s_t_i_t_u_t_e can  be  abbreviated  `s'
while  the shortest available abbreviation for the _s_e_t command is
`se'.
 Counts are rounded down if necessary.
  Examples would be option names in a _s_e_t command i.e. ``set num-
ber'', a file name in an _e_d_i_t command, a regular expression in  a
_s_u_b_s_t_i_t_u_t_e  command, or a target address for a _c_o_p_y command, i.e.
``1,5 copy 25''.
**  A `p' or `l' must be preceded by a blank or tab except in the
single special case `dp'.









USD:12-6                                      Ex Reference Manual


55..44..  CCoommmmeennttss

     It is possible to give editor commands  which  are  ignored.
This  is useful when making complex editor scripts for which com-
ments are desired.  The comment character is the double quote: ".
Any command line beginning with " is ignored.  Comments beginning
with " may also be placed at the  ends  of  commands,  except  in
cases where they could be confused as part of text (shell escapes
and the substitute and map commands).

55..55..  MMuullttiippllee ccoommmmaannddss ppeerr lliinnee

     More than one command may be placed on a line by  separating
each  pair  of  commands  by a `|' character.  However the _g_l_o_b_a_l
commands, comments, and the shell escape `!'  must  be  the  last
command on a line, as they are not terminated by a `|'.

55..66..  RReeppoorrttiinngg llaarrggee cchhaannggeess

     Most commands which change the contents of the editor buffer
give feedback if the scope of  the  change  exceeds  a  threshold
given  by the _r_e_p_o_r_t option.  This feedback helps to detect unde-
sirably large changes so that they  may  be  quickly  and  easily
reversed  with  an  _u_n_d_o_.  After commands with more global effect
such as _g_l_o_b_a_l or _v_i_s_u_a_l_, you will be informed if the net  change
in  the number of lines in the buffer during this command exceeds
this threshold.

66..  CCoommmmaanndd aaddddrreessssiinngg

66..11..  AAddddrreessssiinngg pprriimmiittiivveess

..                   The current line.  Most  commands  leave  the
                    current  line  as  the  last  line which they
                    affect.  The default address  for  most  com-
                    mands is the current line, thus `..' is rarely
                    used alone as an address.

_n                   The _nth line in the  editor's  buffer,  lines
                    being numbered sequentially from 1.

$$                   The last line in the buffer.

%%                   An   abbreviation  for  ``1,$'',  the  entire
                    buffer.

_+_n _-_n               An offset  relative  to  the  current  buffer
                    line.

//_p_a_t// ??_p_a_t??         Scan forward and backward respectively for  a
                    line containing _p_a_t, a regular expression (as
-----------
  The  forms `.+3' `+3' and `+++' are all equivalent; if the cur-
rent line is line 100 they all address line 103.









Ex Reference Manual                                      USD:12-7


                    defined  below).   The  scans  normally  wrap
                    around the end of the buffer.  If all that is
                    desired is to print the next line  containing
                    _p_a_t, then the trailing // or ?? may be omitted.
                    If _p_a_t is omitted or explicitly  empty,  then
                    the  last  regular  expression  specified  is
                    located.

'''' ''_x               Before each non-relative motion of  the  cur-
                    rent  line  `..', the previous current line is
                    marked with a tag, subsequently  referred  to
                    as  `'''.   This  makes  it  easy to refer or
                    return to this previous context.   Marks  may
                    also  be  established  by  the  _m_a_r_k command,
                    using single lower case  letters  _x  and  the
                    marked lines referred to as `'_x'.

66..22..  CCoommbbiinniinngg aaddddrreessssiinngg pprriimmiittiivveess

     Addresses  to  commands  consist  of  a series of addressing
primitives, separated by `,' or  `;'.   Such  address  lists  are
evaluated left-to-right.  When addresses are separated by `;' the
current line `..'  is set to the value of the previous  addressing
expression  before  the  next  address  is  interpreted.  If more
addresses are given than the command requires, then all  but  the
last one or two are ignored.  If the command takes two addresses,
the first addressed line must precede the second in the buffer.

77..  CCoommmmaanndd ddeessccrriippttiioonnss

     The following form is a prototype for all _e_x commands:

     _a_d_d_r_e_s_s ccoommmmaanndd _! _p_a_r_a_m_e_t_e_r_s _c_o_u_n_t _f_l_a_g_s

All  parts are optional; the degenerate case is the empty command
which prints the next line in the file.  For sanity with use from
within _v_i_s_u_a_l mode, _e_x ignores a ``:'' preceding any command.

     In the following command descriptions, the default addresses
are shown in parentheses, which are _n_o_t_,  however,  part  of  the
command.


aabbbbrreevviiaattee _w_o_r_d _r_h_s                     abbr: aabb


-----------
 The forms \\// and \\?? scan using the last regular expression  used
in a scan; after a substitute //// and ???? would scan using the sub-
stitute's regular expression.
  Null  address  specifications  are  permitted  in  a  list   of
addresses, the default in this case is the current line `.'; thus
`,100' is equivalent to `..,100'.  It is an error to give a prefix
address to a command which expects none.









USD:12-8                                      Ex Reference Manual


     Add  the  named  abbreviation  to the current list.  When in
     input mode in visual, if _w_o_r_d is typed as a  complete  word,
     it will be changed to _r_h_s.


( .. ) aappppeenndd                            abbr: aa
_t_e_x_t
..

     Reads the input text and places it after the specified line.
     After the command, `..'  addresses the last line input or the
     specified  line  if  no lines were input.  If address `0' is
     given, text is placed at the beginning of the buffer.


aa!!
_t_e_x_t
..

     The variant flag to  _a_p_p_e_n_d  toggles  the  setting  for  the
     _a_u_t_o_i_n_d_e_n_t option during the input of _t_e_x_t_.


aarrggss

     The  members of the argument list are printed, with the cur-
     rent argument delimited by `[' and `]'.


( .. , .. ) cchhaannggee _c_o_u_n_t                  abbr: cc
_t_e_x_t
..

     Replaces the specified lines with the input _t_e_x_t.  The  cur-
     rent  line  becomes  the  last  line input; if no lines were
     input it is left as for a _d_e_l_e_t_e.


cc!!
_t_e_x_t
..

     The variant toggles _a_u_t_o_i_n_d_e_n_t during the _c_h_a_n_g_e_.


( .. , .. )ccooppyy _a_d_d_r _f_l_a_g_s                abbr: ccoo

     A _c_o_p_y of the specified lines is placed  after  _a_d_d_r_,  which
     may  be  `0'.  The current line `..'  addresses the last line
     of the copy.  The command _t is a synonym for _c_o_p_y_.













Ex Reference Manual                                      USD:12-9


( .. , .. )ddeelleettee _b_u_f_f_e_r _c_o_u_n_t _f_l_a_g_s      abbr: dd

     Removes the specified lines from the buffer.  The line after
     the last line deleted becomes the current line; if the lines
     deleted were originally  at  the  end,  the  new  last  line
     becomes the current line.  If a named _b_u_f_f_e_r is specified by
     giving a letter, then the specified lines are saved in  that
     buffer, or appended to it if an upper case letter is used.


eeddiitt _f_i_l_e                               abbr: ee
eexx _f_i_l_e

     Used  to begin an editing session on a new file.  The editor
     first checks to see if the buffer has  been  modified  since
     the  last _w_r_i_t_e command was issued.  If it has been, a warn-
     ing is issued and the command is aborted.  The command  oth-
     erwise  deletes  the  entire  contents of the editor buffer,
     makes the named file the current file  and  prints  the  new
     filename.   After  insuring  that  this file is sensible the
     editor reads the file into its buffer.

     If the read of the file completes without error, the  number
     of  lines  and  characters read is typed.  If there were any
     non-ASCII characters in the file they are stripped of  their
     non-ASCII high bits, and any null characters in the file are
     discarded.  If none of these errors occurred,  the  file  is
     considered  _e_d_i_t_e_d_.   If  the last line of the input file is
     missing the trailing newline character, it will be  supplied
     and  a  complaint  will  be issued.  This command leaves the
     current line `..' at the last line read.


ee!! _f_i_l_e

     The  variant  form  suppresses the complaint about modifica-
     tions having been made  and  not  written  from  the  editor
     buffer,  thus  discarding  all  changes which have been made
     before editing the new file.


ee ++_n _f_i_l_e

     Causes the editor to begin at line _n rather than at the last
     line;  _n may also be an editor command containing no spaces,
     e.g.: ``+/pat''.


-----------
  I.e., that it is not a binary file such as a directory, a block
or character special file other than _/_d_e_v_/_t_t_y_, a terminal,  or  a
binary or executable file (as indicated by the first word).
 If executed from within _o_p_e_n or _v_i_s_u_a_l_, the current line is ini-
tially the first line of the file.









USD:12-10                                     Ex Reference Manual


ffiillee                                    abbr: ff

     Prints the current file name, whether it  has  been  `[Modi-
     fied]'  since  the  last  _w_r_i_t_e  command, whether it is _r_e_a_d
     _o_n_l_y, the current line, the number of lines in  the  buffer,
     and the percentage of the way through the buffer of the cur-
     rent line.*


ffiillee _f_i_l_e

     The current file name is changed to _f_i_l_e which is considered
     `[Not edited]'.


( 1 , $ ) gglloobbaall /_p_a_t/ _c_m_d_s             abbr: gg

     First marks each line among those  specified  which  matches
     the  given  regular expression.  Then the given command list
     is executed with `..' initially set to each marked line.

     The command list consists of the remaining commands  on  the
     current  input  line  and  may continue to multiple lines by
     ending all but the last such line with a `\'.  If _c_m_d_s  (and
     possibly  the  trailing  //  delimiter) is omitted, each line
     matching _p_a_t is printed.  _A_p_p_e_n_d_, _i_n_s_e_r_t_,  and  _c_h_a_n_g_e  com-
     mands  and associated input are permitted; the `..' terminat-
     ing input may be omitted if it would be on the last line  of
     the command list.  _O_p_e_n and _v_i_s_u_a_l commands are permitted in
     the command list and take input from the terminal.

     The _g_l_o_b_a_l command itself may not appear in _c_m_d_s_.  The  _u_n_d_o
     command  is also not permitted there, as _u_n_d_o instead can be
     used to reverse the  entire  _g_l_o_b_a_l  command.   The  options
     _a_u_t_o_p_r_i_n_t and _a_u_t_o_i_n_d_e_n_t are inhibited during a _g_l_o_b_a_l_, (and
     possibly the trailing // delimiter)  and  the  value  of  the
     _r_e_p_o_r_t  option  is  temporarily  infinite, in deference to a
     _r_e_p_o_r_t for the entire global.   Finally,  the  context  mark
     `'''  is  set  to the value of `.' before the global command
     begins and is not changed during a  global  command,  except
     perhaps by an _o_p_e_n or _v_i_s_u_a_l within the _g_l_o_b_a_l_.


gg!! //_p_a_t// _c_m_d_s                           abbr: vv

     The variant form of _g_l_o_b_a_l runs _c_m_d_s at each line not match-
     ing _p_a_t.


-----------
* In the rare case that the current file is `[Not  edited]'  this
is  noted also; in this case you have to use the form ww!! to write
to the file, since the editor is not sure that a wwrriittee  will  not
destroy a file unrelated to the current contents of the buffer.









Ex Reference Manual                                     USD:12-11


( .. )iinnsseerrtt                             abbr: ii
_t_e_x_t
..

     Places the given text before the specified line.   The  cur-
     rent line is left at the last line input; if there were none
     input it is left at the  line  before  the  addressed  line.
     This  command  differs  from _a_p_p_e_n_d only in the placement of
     text.


ii!!
_t_e_x_t
..

     The variant toggles _a_u_t_o_i_n_d_e_n_t during the _i_n_s_e_r_t_.


( .. , ..+1 ) jjooiinn _c_o_u_n_t _f_l_a_g_s            abbr: jj

     Places the text from a specified range of lines together  on
     one  line.  White space is adjusted at each junction to pro-
     vide at least one blank character, two if there was a `..' at
     the  end of the line, or none if the first following charac-
     ter is a `)'.  If there is already white space at the end of
     the line, then the white space at the start of the next line
     will be discarded.


jj!!

     The variant causes a simpler _j_o_i_n with no white  space  pro-
     cessing;  the  characters  in  the lines are simply concate-
     nated.


( .. ) kk _x

     The _k command is a synonym for _m_a_r_k_.  It does not require  a
     blank or tab before the following letter.


( .. , .. ) lliisstt _c_o_u_n_t _f_l_a_g_s

     Prints  the  specified lines in a more unambiguous way: tabs
     are printed as `^I' and the end of each line is marked  with
     a  trailing  `$'.  The current line is left at the last line
     printed.


mmaapp _l_h_s _r_h_s

     The _m_a_p command is used to define macros for use  in  _v_i_s_u_a_l
     mode.   _L_h_s  should  be  a single character, or the sequence









USD:12-12                                     Ex Reference Manual


     ``#n'', for n a digit, referring to function  key  _n.   When
     this  character  or function key is typed in _v_i_s_u_a_l mode, it
     will be as though the corresponding _r_h_s had been typed.   On
     terminals  without  function keys, you can type ``#n''.  See
     section 6.9 of the ``Introduction to  Display  Editing  with
     Vi'' for more details.


( .. ) mmaarrkk _x

     Gives the specified line mark _x_, a single lower case letter.
     The _x must be preceded by a blank or a tab.  The  addressing
     form `'x' then addresses this line.  The current line is not
     affected by this command.


( .. , .. ) mmoovvee _a_d_d_r                     abbr: mm

     The _m_o_v_e command repositions the specified lines to be after
     _a_d_d_r.   The  first  of  the  moved lines becomes the current
     line.


nneexxtt                                    abbr: nn

     The next file from the command line argument list is edited.


nn!!

     The  variant  suppresses warnings about the modifications to
     the buffer not having been written  out,  discarding  (irre-
     trievably) any changes which may have been made.


nn _f_i_l_e_l_i_s_t
nn ++_c_o_m_m_a_n_d _f_i_l_e_l_i_s_t

     The  specified  _f_i_l_e_l_i_s_t  is expanded and the resulting list
     replaces the current argument list; the first  file  in  the
     new  list is then edited.  If _c_o_m_m_a_n_d is given (it must con-
     tain no spaces), then it is executed after editing the first
     such file.


( .. , .. ) nnuummbbeerr _c_o_u_n_t _f_l_a_g_s            abbr: ## or nnuu

     Prints  each specified line preceded by its buffer line num-
     ber.  The current line is left at the last line printed.














Ex Reference Manual                                     USD:12-13


( .. ) ooppeenn _f_l_a_g_s                        abbr: oo
( .. ) ooppeenn /_p_a_t/ _f_l_a_g_s

     Enters intraline editing _o_p_e_n mode at each  addressed  line.
     If _p_a_t is given, then the cursor will be placed initially at
     the beginning of the string matched by the pattern.  To exit
     this  mode  use  Q.   See _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _D_i_s_p_l_a_y _E_d_i_t_i_n_g
     _w_i_t_h _V_i for more details.


pprreesseerrvvee

     The current editor buffer is saved as though the system  had
     just  crashed.   This command is for use only in emergencies
     when a _w_r_i_t_e command has resulted in an error and you  don't
     know  how  to  save  your work.  After a _p_r_e_s_e_r_v_e you should
     seek help.


( .. , .. )pprriinntt _c_o_u_n_t                    abbr: pp or PP

     Prints the  specified  lines  with  non-printing  characters
     printed  as  control  characters `^_x'; delete (octal 177) is
     represented as `^?'.  The current line is left at  the  last
     line printed.


( .. )ppuutt _b_u_f_f_e_r                         abbr: ppuu

     Puts back previously _d_e_l_e_t_e_d or _y_a_n_k_e_d lines.  Normally used
     with _d_e_l_e_t_e to effect movement of lines,  or  with  _y_a_n_k  to
     effect  duplication  of  lines.   If no _b_u_f_f_e_r is specified,
     then the last _d_e_l_e_t_e_d or _y_a_n_k_e_d text is restored.*  By using
     a named buffer, text may be restored that was saved there at
     any previous time.


qquuiitt                                    abbr: qq

     Causes _e_x to terminate.  No automatic write  of  the  editor
     buffer to a file is performed.  However, _e_x issues a warning
     message if the file has changed since the last _w_r_i_t_e command
     was issued, and does not _q_u_i_t_.  Normally, you will  wish  to
     save  your  changes, and you should give a _w_r_i_t_e command; if
     you wish to discard them, use the qq!! command variant.



-----------
* But no modifying commands may intervene between the  _d_e_l_e_t_e  or
_y_a_n_k  and  the  _p_u_t_, nor may lines be moved between files without
using a named buffer.
  _E_x  will also issue a diagnostic if there are more files in the
argument list.









USD:12-14                                     Ex Reference Manual


qq!!

     Quits from the editor,  discarding  changes  to  the  buffer
     without complaint.


( .. ) rreeaadd _f_i_l_e                         abbr: rr

     Places  a  copy of the text of the given file in the editing
     buffer after the specified line.  If no _f_i_l_e  is  given  the
     current  file  name  is  used.  The current file name is not
     changed unless there is none in which case _f_i_l_e becomes  the
     current  name.   The  sensibility  restrictions for the _e_d_i_t
     command apply here also.  If the file buffer  is  empty  and
     there is no current name then _e_x treats this as an _e_d_i_t com-
     mand.

     Address `0' is legal for this command and causes the file to
     be  read  at  the  beginning  of the buffer.  Statistics are
     given as for the _e_d_i_t command  when  the  _r_e_a_d  successfully
     terminates.   After a _r_e_a_d the current line is the last line
     read.


( .. ) rreeaadd  !!_c_o_m_m_a_n_d

     Reads  the  output  of  the  command _c_o_m_m_a_n_d into the buffer
     after the specified line.  This is not a variant form of the
     command,  rather  a  read specifying a _c_o_m_m_a_n_d rather than a
     _f_i_l_e_n_a_m_e_; a blank or tab before the !! is mandatory.


rreeccoovveerr _f_i_l_e

     Recovers _f_i_l_e from the system save area.  Used after a acci-
     dental hangup of the phone** or a system crash** or _p_r_e_s_e_r_v_e
     command.   Except when you use _p_r_e_s_e_r_v_e you will be notified
     by mail when a file is saved.


rreewwiinndd                                  abbr: rreeww

     The argument list is rewound, and the first file in the list
     is edited.


rreeww!!


-----------
 Within _o_p_e_n and _v_i_s_u_a_l the current line is set to the first line
read rather than the last.
**  The  system saves a copy of the file you were editing only if
you have made changes to the file.









Ex Reference Manual                                     USD:12-15


     Rewinds the argument list discarding any changes made to the
     current buffer.


sseett _p_a_r_a_m_e_t_e_r

     With no arguments, prints those options  whose  values  have
     been  changed  from  their  defaults;  with parameter _a_l_l it
     prints all of the option values.

     Giving an option name followed by a `?'  causes the  current
     value  of that option to be printed.  The `?' is unnecessary
     unless the option is Boolean valued.   Boolean  options  are
     given values either by the form `set _o_p_t_i_o_n' to turn them on
     or `set no_o_p_t_i_o_n' to  turn  them  off;  string  and  numeric
     options are assigned via the form `set _o_p_t_i_o_n=value'.

     More than one parameter may be given to _s_e_t; they are inter-
     preted left-to-right.


sshheellll                                   abbr: sshh

     A  new  shell  is  created.   When  it  terminates,  editing
     resumes.


ssoouurrccee _f_i_l_e                             abbr: ssoo

     Reads and executes commands from the specified file.  _S_o_u_r_c_e
     commands may be nested.


( .. , .. ) ssuubbssttiittuuttee /_p_a_t/_r_e_p_l/ _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_sabbr: ss

     On each specified line, the first instance of pattern _p_a_t is
     replaced by replacement pattern _r_e_p_l_.  If the _g_l_o_b_a_l indica-
     tor option character `g' appears,  then  all  instances  are
     substituted;   if   the  _c_o_n_f_i_r_m  indication  character  `c'
     appears, then before each substitution the line to  be  sub-
     stituted  is  typed with the string to be substituted marked
     with `' characters.  By typing an `y' one can cause the sub-
     stitution  to be performed, any other input causes no change
     to take place.  After a _s_u_b_s_t_i_t_u_t_e the current line  is  the
     last line substituted.

     Lines  may be split by substituting new-line characters into
     them.  The newline in _r_e_p_l must be escaped by  preceding  it
     with  a `\'.  Other metacharacters available in _p_a_t and _r_e_p_l
     are described below.













USD:12-16                                     Ex Reference Manual


ssttoopp

     Suspends the editor, returning  control  to  the  top  level
     shell.  If _a_u_t_o_w_r_i_t_e is set and there are unsaved changes, a
     write is done first unless the form ssttoopp!   is  used.   This
     commands  is  only available where supported by the teletype
     driver and operating system.


( .. , .. ) ssuubbssttiittuuttee _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_sabbr: ss

     If _p_a_t and _r_e_p_l are omitted, then the last  substitution  is
     repeated.  This is a synonym for the && command.


( .. , .. ) tt _a_d_d_r _f_l_a_g_s

     The _t command is a synonym for _c_o_p_y.


ttaa _t_a_g

     The  focus  of  editing  switches  to  the  location of _t_a_g_,
     switching to a different line in the current file  where  it
     is defined, or if necessary to another file.

     The  tags  file  is  normally  created  by a program such as
     _c_t_a_g_s_, and consists of a number of lines with  three  fields
     separated by blanks or tabs.  The first field gives the name
     of the tag, the second the name of the file  where  the  tag
     resides, and the third gives an addressing form which can be
     used by the editor to find the tag; this field is usually  a
     contextual  scan using `/_p_a_t/' to be immune to minor changes
     in the file.  Such scans are always performed as if  _n_o_m_a_g_i_c
     was set.

     The  tag  names  in  the tags file must be sorted alphabeti-
cally.


uunnaabbbbrreevviiaattee _w_o_r_d                       abbr: uunnaa

     Delete _w_o_r_d from the list of abbreviations.


uunnddoo                                    abbr: uu

     Reverses the changes made in the buffer by the  last  buffer
     editing command.  Note that _g_l_o_b_a_l commands are considered a
     single command for the purpose of  _u_n_d_o  (as  are  _o_p_e_n  and
-----------
  If  you have modified the current file before giving a _t_a_g com-
mand, you must write it out; giving another _t_a_g command, specify-
ing no _t_a_g will reuse the previous tag.









Ex Reference Manual                                     USD:12-17


     _v_i_s_u_a_l_._)   Also,  the commands _w_r_i_t_e and _e_d_i_t which interact
     with the file system cannot be  undone.   _U_n_d_o  is  its  own
     inverse.

     _U_n_d_o always marks the previous value of the current line `..'
     as `'''.  After an _u_n_d_o the current line is the  first  line
     restored  or  the  line  before the first line deleted if no
     lines were restored.  For commands with more  global  effect
     such as _g_l_o_b_a_l and _v_i_s_u_a_l the current line regains it's pre-
     command value after an _u_n_d_o_.


uunnmmaapp _l_h_s

     The macro expansion associated by _m_a_p for _l_h_s is removed.


( 1 , $ ) vv /_p_a_t/ _c_m_d_s

     A synonym for the _g_l_o_b_a_l command  variant  gg!!,  running  the
     specified _c_m_d_s on each line which does not match _p_a_t.


vveerrssiioonn                                 abbr: vvee

     Prints  the  current version number of the editor as well as
     the date the editor was last changed.


( .. ) vviissuuaall _t_y_p_e _c_o_u_n_t _f_l_a_g_s           abbr: vvii

     Enters visual mode at the specified line.  _T_y_p_e is  optional
     and  may  be `-' , `' or `..'  as in the _z command to specify
     the placement of the  specified  line  on  the  screen.   By
     default, if _t_y_p_e is omitted, the specified line is placed as
     the first on the screen.  A _c_o_u_n_t specifies an initial  win-
     dow  size;  the  default  is the value of the option _w_i_n_d_o_w_.
     See the document _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _D_i_s_p_l_a_y _E_d_i_t_i_n_g _w_i_t_h  _V_i
     for more details.  To exit this mode, type Q.


vviissuuaall file
vviissuuaall +_n file

     From visual mode, this command is the same as edit.


( 1 , $ ) wwrriittee _f_i_l_e                    abbr: ww

     Writes  changes  made  back  to _f_i_l_e, printing the number of
     lines and characters written.  Normally _f_i_l_e is omitted  and
     the  text goes back where it came from.  If a _f_i_l_e is speci-











USD:12-18                                     Ex Reference Manual


     fied,  then text will be written to that file.*  If the file
     does not exist it is created.   The  current  file  name  is
     changed  only  if there is no current file name; the current
     line is never changed.

     If an error occurs while  writing  the  current  and  _e_d_i_t_e_d
     file,  the  editor  considers that there has been ``No write
     since last change'' even if the buffer  had  not  previously
     been modified.


( 1 , $ ) wwrriittee>>>> _f_i_l_e                  abbr: ww>>>>

     Writes the buffer contents at the end of an existing file.



ww!! _n_a_m_e

     Overrides the checking of the normal _w_r_i_t_e command, and will
     write to any file which the system permits.


( 1 , $ ) ww  !!_c_o_m_m_a_n_d

     Writes the specified lines into _c_o_m_m_a_n_d_.  Note  the  differ-
     ence between ww!! which overrides checks and ww  !! which writes
     to a command.


wwqq _n_a_m_e

     Like a _w_r_i_t_e and then a _q_u_i_t command.


wwqq!! _n_a_m_e

     The variant overrides checking on  the  sensibility  of  the
     _w_r_i_t_e command, as ww!! does.


xxiitt _n_a_m_e

     If  any  changes  have been made and not written, writes the
     buffer out.  Then, in any case, quits.




-----------
* The editor writes to a file only if it is the current file  and
is _e_d_i_t_e_d, if the file does not exist, or if the file is actually
a teletype, _/_d_e_v_/_t_t_y_, _/_d_e_v_/_n_u_l_l_.  Otherwise, you  must  give  the
variant form ww!! to force the write.









Ex Reference Manual                                     USD:12-19


( .. , .. )yyaannkk _b_u_f_f_e_r _c_o_u_n_t              abbr: yyaa

     Places the specified lines in the named  _b_u_f_f_e_r_,  for  later
     retrieval  via  _p_u_t_.   If  no  buffer name is specified, the
     lines go to a more  volatile  place;  see  the  _p_u_t  command
     description.


( ..++11 ) zz _c_o_u_n_t

     Print the next _c_o_u_n_t lines, default _w_i_n_d_o_w.


( .. ) zz _t_y_p_e _c_o_u_n_t

     Prints  a window of text with the specified line at the top.
     If _t_y_p_e is `-' the line is  placed  at  the  bottom;  a  `..'
     causes  the line to be placed in the center.*  A count gives
     the number of lines to be displayed rather than  double  the
     number  specified by the _s_c_r_o_l_l option.  On a CRT the screen
     is cleared before display begins unless  a  count  which  is
     less  than  the  screen  size is given.  The current line is
     left at the last line printed.


!! _c_o_m_m_a_n_d

     The remainder of the line after the `!' character is sent to
     a shell to be executed.  Within  the  text  of  _c_o_m_m_a_n_d  the
     characters  `%' and `#' are expanded as in filenames and the
     character `!' is replaced with the text of the previous com-
     mand.  Thus, in particular, `!!' repeats the last such shell
     escape.  If any such expansion is  performed,  the  expanded
     line  will be echoed.  The current line is unchanged by this
     command.

     If there has been  ``[No write]''  of  the  buffer  contents
     since the last change to the editing buffer, then a diagnos-
     tic will be printed before the  command  is  executed  as  a
     warning.   A  single  `!'  is  printed when the command com-
     pletes.


( _a_d_d_r , _a_d_d_r ) !! _c_o_m_m_a_n_d

     Takes the specified address range and supplies it  as  stan-
     dard  input  to  _c_o_m_m_a_n_d_; the resulting output then replaces
-----------
* Forms `z=' and `z' also exist; `z=' places the current line  in
the  center, surrounds it with lines of `-' characters and leaves
the current line at this line.  The form `z'  prints  the  window
before  `z-'  would.   The  characters  `+',  `'  and  `-' may be
repeated for cumulative effect.  On some v2 editors, no _t_y_p_e  may
be given.









USD:12-20                                     Ex Reference Manual


     the input lines.


( $ ) ==

     Prints the line number of the addressed line.   The  current
     line is unchanged.


( .. , .. ) >> _c_o_u_n_t _f_l_a_g_s
( .. , .. ) << _c_o_u_n_t _f_l_a_g_s

     Perform  intelligent  shifting  on  the  specified  lines; <<
     shifts left and >> shift right.  The  quantity  of  shift  is
     determined  by  the  _s_h_i_f_t_w_i_d_t_h option and the repetition of
     the specification character.  Only white space  (blanks  and
     tabs) is shifted; no non-white characters are discarded in a
     left-shift.  The current line becomes the  last  line  which
     changed due to the shifting.


^^DD

     An  end-of-file  from  a  terminal input scrolls through the
     file.  The _s_c_r_o_l_l option specifies the size of  the  scroll,
     normally a half screen of text.


( ..+1 , ..+1 )
( ..+1 , ..+1 ) |

     An  address  alone causes the addressed lines to be printed.
     A blank line prints the next line in the file.


( .. , .. ) && _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_s

     Repeats the previous _s_u_b_s_t_i_t_u_t_e command.


( .. , .. ) ~~ _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_s

     Replaces the previous regular expression with  the  previous
     replacement pattern from a substitution.

88..  RReegguullaarr eexxpprreessssiioonnss aanndd ssuubbssttiittuuttee rreeppllaacceemmeenntt ppaatttteerrnnss

88..11..  RReegguullaarr eexxpprreessssiioonnss

     A  regular  expression specifies a set of strings of charac-
ters.  A member of this set of strings is said to be  _m_a_t_c_h_e_d  by
the  regular  expression.   _E_x  remembers  two  previous  regular
expressions: the previous regular expression used in a _s_u_b_s_t_i_t_u_t_e
command  and  the  previous  regular  expression  used  elsewhere









Ex Reference Manual                                     USD:12-21


(referred to as the previous _s_c_a_n_n_i_n_g regular  expression.)   The
previous  regular  expression can always be referred to by a null
_r_e, e.g. `//' or `??'.

88..22..  MMaaggiicc aanndd nnoommaaggiicc

     The regular expressions allowed by _e_x are constructed in one
of two ways depending on the setting of the _m_a_g_i_c option.  The _e_x
and _v_i default setting of _m_a_g_i_c gives quick access to a  powerful
set  of  regular  expression metacharacters.  The disadvantage of
_m_a_g_i_c is that the user must remember  that  these  metacharacters
are  _m_a_g_i_c and precede them with the character `\' to use them as
``ordinary'' characters.  With _n_o_m_a_g_i_c_,  the  default  for  _e_d_i_t_,
regular  expressions  are  much  simpler,  there  being  only two
metacharacters.  The power of the other metacharacters  is  still
available  by  preceding the (now) ordinary character with a `\'.
Note that `\' is thus always a metacharacter.

     The remainder  of  the  discussion  of  regular  expressions
assumes that that the setting of this option is _m_a_g_i_c_.

88..33..  BBaassiicc rreegguullaarr eexxpprreessssiioonn ssuummmmaarryy

     The following basic constructs are used to  construct  _m_a_g_i_c
mode regular expressions.

_c_h_a_r           An ordinary character matches itself.  The charac-
               ters `' at the beginning of a line, `$' at the end
               of  line,  `*'  as  any  character  other than the
               first, `.', `\', `[', and  `~'  are  not  ordinary
               characters  and  must be escaped (preceded) by `\'
               to be treated as such.

               At the beginning of a pattern forces the match  to
               succeed only at the beginning of a line.

$$              At  the  end  of  a  regular expression forces the
               match to succeed only at the end of the line.

..              Matches any single character except  the  new-line
               character.

\\<<             Forces the match to occur only at the beginning of
               a ``variable'' or ``word''; that is, either at the
               beginning  of  a  line,  or  just before a letter,
               digit, or underline and after a character not  one
               of these.
-----------
  To  discern  what  is true with _n_o_m_a_g_i_c it suffices to remember
that the only special characters in this case will be `'  at  the
beginning  of  a  regular expression, `$' at the end of a regular
expression, and `\'.  With _n_o_m_a_g_i_c the  characters  `~'  and  `&'
also  lose their special meanings related to the replacement pat-
tern of a substitute.









USD:12-22                                     Ex Reference Manual


\\>>             Similar to `\<', but matching the end of a ``vari-
               able'' or ``word'', i.e. either  the  end  of  the
               line  or  before character which is neither a let-
               ter, nor a digit, nor the underline character.

[[_s_t_r_i_n_g]       Matches  any  (single)  character  in  the   class
               defined  by  _s_t_r_i_n_g_.   Most  characters  in _s_t_r_i_n_g
               define themselves.  A pair of characters separated
               by  `-'  in  _s_t_r_i_n_g  defines the set of characters
               collating between the specified  lower  and  upper
               bounds,  thus  `[a-z]'  as  a  regular  expression
               matches any (single) lower-case  letter.   If  the
               first  character  of _s_t_r_i_n_g is an `' then the con-
               struct matches those characters which it otherwise
               would  not;  thus  `[a-z]'  matches anything but a
               lower-case letter (and of course a  newline).   To
               place  any  of  the  characters `', `[', or `-' in
               _s_t_r_i_n_g you must escape them with a preceding  `\'.

88..44..  CCoommbbiinniinngg rreegguullaarr eexxpprreessssiioonn pprriimmiittiivveess

     The  concatenation  of  two  regular expressions matches the
leftmost and then longest string which can be  divided  with  the
first  piece matching the first regular expression and the second
piece matching the second.  Any of the (single  character  match-
ing)  regular  expressions mentioned above may be followed by the
character `*' to form a regular expression which matches any num-
ber  of  adjacent occurrences (including 0) of characters matched
by the regular expression it follows.

     The character `~' may be used in a regular  expression,  and
matches  the  text which defined the replacement part of the last
_s_u_b_s_t_i_t_u_t_e command.  A regular expression may be enclosed between
the  sequences  `\(' and `\)' with side effects in the _s_u_b_s_t_i_t_u_t_e
replacement patterns.

88..55..  SSuubbssttiittuuttee rreeppllaacceemmeenntt ppaatttteerrnnss

     The basic metacharacters for the replacement pattern are `&'
and  `~';  these  are given as `\&' and `\~' when _n_o_m_a_g_i_c is set.
Each instance of `&' is replaced by the characters which the reg-
ular  expression  matched.   The metacharacter `~' stands, in the
replacement pattern,  for  the  defining  text  of  the  previous
replacement pattern.

     Other  metasequences possible in the replacement pattern are
always introduced by the escaping character  `\'.   The  sequence
`\_n'  is  replaced by the text matched by the _n-th regular subex-
pression enclosed between `\(' and `\)'.  The sequences `\u'  and
`\l' cause the immediately following character in the replacement
-----------
 When nested, parenthesized  subexpressions  are  present,  _n  is
determined  by  counting  occurrences  of  `\(' starting from the
left.









Ex Reference Manual                                     USD:12-23


to be converted to upper-  or  lower-case  respectively  if  this
character  is  a  letter.   The sequences `\U' and `\L' turn such
conversion on, either until `\E' or `\e' is encountered, or until
the end of the replacement pattern.

99..  OOppttiioonn ddeessccrriippttiioonnss



aauuttooiinnddeenntt, aaii                default: noai

     Can  be  used  to ease the preparation of structured program
     text.  At the beginning of each  _a_p_p_e_n_d,  _c_h_a_n_g_e  or  _i_n_s_e_r_t
     command  or  when  a  new  line  is  _o_p_e_n_e_d or created by an
     _a_p_p_e_n_d, _c_h_a_n_g_e, _i_n_s_e_r_t, or _s_u_b_s_t_i_t_u_t_e operation within  _o_p_e_n
     or  _v_i_s_u_a_l  mode, _e_x looks at the line being appended after,
     the first line changed or the line inserted before and  cal-
     culates  the amount of white space at the start of the line.
     It then aligns the cursor at the  level  of  indentation  so
     determined.

     If  the user then types lines of text in, they will continue
     to be justified at the displayed indenting level.   If  more
     white space is typed at the beginning of a line, the follow-
     ing line will start aligned with the first non-white charac-
     ter of the previous line.  To back the cursor up to the pre-
     ceding tab stop one can hit ^^DD.  The tab stops  going  back-
     wards  are  defined  at  multiples of the _s_h_i_f_t_w_i_d_t_h option.
     You _c_a_n_n_o_t backspace over the indent, except by  sending  an
     end-of-file with a ^^DD.

     Specially  processed  in this mode is a line with no charac-
     ters added to it, which turns into a completely  blank  line
     (the  white space provided for the _a_u_t_o_i_n_d_e_n_t is discarded.)
     Also specially processed in this mode  are  lines  beginning
     with  an  `'  and immediately followed by a ^^DD.  This causes
     the input to be repositioned at the beginning of  the  line,
     but  retaining the previous indent for the next line.  Simi-
     larly, a `0' followed by a ^^DD repositions at  the  beginning
     but without retaining the previous indent.

     _A_u_t_o_i_n_d_e_n_t  doesn't  happen  in  _g_l_o_b_a_l commands or when the
     input is not a terminal.


aauuttoopprriinntt, aapp                 default: ap

     Causes the current line to be  printed  after  each  _d_e_l_e_t_e,
     _c_o_p_y,  _j_o_i_n,  _m_o_v_e,  _s_u_b_s_t_i_t_u_t_e,  _t,  _u_n_d_o or shift command.
     This has the same effect as supplying a trailing `p' to each
     such  command.  _A_u_t_o_p_r_i_n_t is suppressed in globals, and only
     applies to the last of many commands on a line.











USD:12-24                                     Ex Reference Manual


aauuttoowwrriittee, aaww                 default: noaw

     Causes the contents of the buffer to be written to the  cur-
     rent  file  if you have modified it and give a _n_e_x_t_, _r_e_w_i_n_d_,
     _s_t_o_p_, _t_a_g_, or _!  command, or a ^^ (switch files) or  ^^]]  (tag
     goto)  command  in  _v_i_s_u_a_l_.  Note, that the _e_d_i_t and _e_x com-
     mands do nnoott autowrite.  In each case, there is  an  equiva-
     lent  way  of  switching  when autowrite is set to avoid the
     _a_u_t_o_w_r_i_t_e (_e_d_i_t for _n_e_x_t, _r_e_w_i_n_d_!  for  .I  rewind  ,  _s_t_o_p_!
     for  _s_t_o_p,  _t_a_g_!   for _t_a_g, _s_h_e_l_l for _!, and ::ee ## and a ::ttaa!!
     command from within _v_i_s_u_a_l_)_.


bbeeaauuttiiffyy, bbff                  default: nobeautify

     Causes all control characters except tab, newline and  form-
     feed  to be discarded from the input.  A complaint is regis-
     tered the first time a  backspace  character  is  discarded.
     _B_e_a_u_t_i_f_y does not apply to command input.


ddiirreeccttoorryy, ddiirr                default: dir=/tmp

     Specifies  the directory in which _e_x places its buffer file.
     If this directory in not writable, then the editor will exit
     abruptly  when  it  fails  to  be  able to create its buffer
     there.


eeddccoommppaattiibbllee                  default: noedcompatible

     Causes the presence of absence of gg and cc suffixes  on  sub-
     stitute  commands  to  be  remembered,  and to be toggled by
     repeating the suffices.  The suffix rr makes the substitution
     be as in the _~ command, instead of like _&_.


eerrrroorrbbeellllss, eebb                default: noeb

     Error messages are preceded by a  bell.*   If  possible  the
     editor always places the error message in a standout mode of
     the terminal (such as inverse video) instead of ringing  the
     bell.


hhaarrddttaabbss, hhtt                  default: ht=8

     Gives the boundaries on which terminal hardware tabs are set
     (or on which the system expands tabs).


-----------
*  Bell ringing in _o_p_e_n and _v_i_s_u_a_l on errors is not suppressed by
setting _n_o_e_b_.









Ex Reference Manual                                     USD:12-25


iiggnnoorreeccaassee, iicc                default: noic

     All upper case characters in the text are  mapped  to  lower
     case in regular expression matching.  In addition, all upper
     case characters in regular expressions are mapped  to  lower
     case except in character class specifications.


lliisspp                          default: nolisp

     _A_u_t_o_i_n_d_e_n_t  indents appropriately for _l_i_s_p code, and the (( ))
     {{ }} [[[[ and ]]]] commands in _o_p_e_n and _v_i_s_u_a_l  are  modified  to
     have meaning for _l_i_s_p.


lliisstt                          default: nolist

     All  printed  lines  will be displayed (more) unambiguously,
     showing tabs and end-of-lines as in the _l_i_s_t command.


mmaaggiicc                         default: magic for _e_x and _v_i

     If  _n_o_m_a_g_i_c  is  set,  the  number  of  regular   expression
     metacharacters is greatly reduced, with only `' and `$' hav-
     ing special effects.  In addition the metacharacters `~' and
     `&' of the replacement pattern are treated as normal charac-
     ters.  All the normal metacharacters may be made _m_a_g_i_c  when
     _n_o_m_a_g_i_c is set by preceding them with a `\'.


mmeessgg                          default: mesg

     Causes  write  permission  to  be turned off to the terminal
     while you are in visual mode, if _n_o_m_e_s_g is set.


mmooddeelliinnee                      default: nomodeline

     If _m_o_d_e_l_i_n_e is set, then the first 5 lines and the last five
     lines  of  the file will be checked for ex command lines and
     the comands issued.  To be recognized as a command line, the
     line must have the string eexx:: or vvii:: preceeded by a tab or a
     space.  This string may be anywhere in the line and anything
     after  the  _: is interpeted as editor commands.  This option
     defaults to off because of unexpected behavior when editting
     files such as _/_e_t_c_/_p_a_s_s_w_d_.


nnuummbbeerr,, nnuu                    default: nonumber


-----------
 _N_o_m_a_g_i_c for _e_d_i_t.









USD:12-26                                     Ex Reference Manual


     Causes  all  output lines to be printed with their line num-
     bers.  In addition each input line will be prompted  for  by
     supplying the line number it will have.


ooppeenn                          default: open

     If  _n_o_o_p_e_n,  the commands _o_p_e_n and _v_i_s_u_a_l are not permitted.
     This is set for _e_d_i_t to  prevent  confusion  resulting  from
     accidental entry to open or visual mode.


ooppttiimmiizzee,, oopptt                 default: optimize

     Throughput  of  text is expedited by setting the terminal to
     not do automatic carriage returns when  printing  more  than
     one  (logical)  line  of  output, greatly speeding output on
     terminals without addressable cursors when text with leading
     white space is printed.


ppaarraaggrraapphhss,, ppaarraa              default: para=IPLPPPQPP LIbp

     Specifies  the paragraphs for the {{ and }} operations in _o_p_e_n
     and _v_i_s_u_a_l_.  The pairs of characters in the  option's  value
     are the names of the macros which start paragraphs.


pprroommpptt                        default: prompt

     Command mode input is prompted for with a `:'.


rreeddrraaww                        default: noredraw

     The  editor  simulates  (using  great amounts of output), an
     intelligent terminal on a dumb terminal (e.g. during  inser-
     tions  in  _v_i_s_u_a_l  the characters to the right of the cursor
     position are refreshed as each input  character  is  typed.)
     Useful only at very high speed.


rreemmaapp                         default: remap

     If on, macros are repeatedly tried until they are unchanged.
     For example, if oo is mapped to OO, and OO is mapped to II, then
     if  _r_e_m_a_p is set, oo will map to II, but if _n_o_r_e_m_a_p is set, it
     will map to OO.


rreeppoorrtt                        default: report=5

-----------
 2 for _e_d_i_t.









Ex Reference Manual                                     USD:12-27


     Specifies a threshold for feedback from commands.  Any  com-
     mand  which modifies more than the specified number of lines
     will provide feedback as to the scope of its  changes.   For
     commands  such  as _g_l_o_b_a_l, _o_p_e_n, _u_n_d_o, and _v_i_s_u_a_l which have
     potentially more far reaching scope, the net change  in  the
     number of lines in the buffer is presented at the end of the
     command, subject to this same threshold.  Thus  notification
     is suppressed during a _g_l_o_b_a_l command on the individual com-
     mands performed.


ssccrroollll                        default: scroll=1/2 window

     Determines the number of logical lines scrolled when an end-
     of-file  is  received from a terminal input in command mode,
     and the number of lines printed by a command mode _z  command
     (double the value of _s_c_r_o_l_l).


sseeccttiioonnss                      default: sections=SHNHH HU

     Specifies the section macros for the [[[[ and ]]]] operations in
     _o_p_e_n and _v_i_s_u_a_l_.  The pairs of characters in  the  options's
     value are the names of the macros which start paragraphs.


sshheellll, sshh                     default: sh=/bin/sh

     Gives the path name of the shell forked for the shell escape
     command `!', and by the _s_h_e_l_l command.  The default is taken
     from SHELL in the environment, if present.


sshhiiffttwwiiddtthh, ssww                default: sw=8

     Gives the width a software tab stop, used in reverse tabbing
     with ^^DD when using _a_u_t_o_i_n_d_e_n_t to append  text,  and  by  the
     shift commands.


sshhoowwmmaattcchh,, ssmm                 default: nosm

     In  _o_p_e_n  and  _v_i_s_u_a_l mode, when a )) or }} is typed, move the
     cursor to the matching (( or {{ for one second if this  match-
     ing character is on the screen.  Extremely useful with _l_i_s_p_.


sslloowwooppeenn,, ssllooww                terminal dependent

     Affects the display algorithm used in _v_i_s_u_a_l  mode,  holding
     off  display  updating  during  input of new text to improve
     throughput when the terminal in use is both slow  and  unin-
     telligent.   See  _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _D_i_s_p_l_a_y _E_d_i_t_i_n_g _w_i_t_h _V_i
     for more details.









USD:12-28                                     Ex Reference Manual


ttaabbssttoopp,, ttss                   default: ts=8

     The editor expands tabs in the input file to be  on  _t_a_b_s_t_o_p
     boundaries for the purposes of display.


ttaagglleennggtthh,, ttll                 default: tl=0

     Tags  are  not  significant  beyond this many characters.  A
     value of zero (the default) means that  all  characters  are
     significant.


ttaaggss                          default: tags=tags /usr/lib/tags

     A path of files to be used as tag files for the _t_a_g command.
     A requested tag is searched  for  in  the  specified  files,
     sequentially.   By  default,  files called ttaaggss are searched
     for in the current directory and in /usr/lib (a master  file
     for the entire system).


tteerrmm                          from environment TERM

     The terminal type of the output device.


tteerrssee                         default: noterse

     Shorter  error  diagnostics are produced for the experienced
     user.


wwaarrnn                          default: warn

     Warn if there has been `[No write since last change]' before
     a `!'  command escape.


wwiinnddooww                        default: window=speed dependent

     The  number of lines in a text window in the _v_i_s_u_a_l command.
     The default is 8 at slow speeds (600 baud or  less),  16  at
     medium  speed  (1200  baud),  and the full screen (minus one
     line) at higher speeds.


ww330000,, ww11220000 ww99660000

     These are not true options but set wwiinnddooww only if the  speed
     is  slow (300), medium (1200), or high (9600), respectively.
     They are suitable for an EXINIT and make it easy  to  change
     the 8/16/full screen rule.










Ex Reference Manual                                     USD:12-29


wwrraappssccaann, wwss                  default: ws

     Searches  using  the  regular expressions in addressing will
     wrap around past the end of the file.


wwrraappmmaarrggiinn, wwmm                default: wm=0

     Defines a margin for automatic wrapover of text during input
     in _o_p_e_n and _v_i_s_u_a_l modes.  See _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _T_e_x_t _E_d_i_t_-
     _i_n_g _w_i_t_h _V_i for details.


wwrriitteeaannyy, wwaa                  default: nowa

     Inhibit the checks  normally  made  before  _w_r_i_t_e  commands,
     allowing  a  write  to  any file which the system protection
     mechanism will allow.

1100..  AAcckknnoowwlleeddggeemmeennttss

     Chuck Haley contributed greatly to the early development  of
_e_x_.  Bruce Englar encouraged the redesign which led to _e_x version
1.  Bill Joy wrote versions 1 and 2.0 through  2.7,  and  created
the  framework that users see in the present editor.  Mark Horton
added macros and other features and made the  editor  work  on  a
large number of terminals and Unix systems.

































