








                       EExx RReeffeerreennccee MMaannuuaall
                           VVeerrssiioonn 33..77


                           _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.


11..  SSttaarrttiinngg eexx

     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:

     eexx [ -- ] [ --vv ] [ --tt _t_a_g ] [ --rr ] [ --ll ] [ --ww_n ] [ --xx ] [ --RR ] [ ++_c_o_m_m_a_n_d ] name ...

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

     eexx name

The -- command line option option suppresses all  interactive-user
feedback  and  is  useful in processing editor scripts in command
files.  The --vv option is equivalent to using _v_i rather  than  _e_x_.
The  --tt  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 --rr 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 --ll option sets up for editing LISP, setting the _s_h_o_w_m_a_t_c_h and
_l_i_s_p  options.   The --ww option sets the default window size to _n_,
and is useful on dialups to  start  in  small  windows.   The  --xx
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 --RR 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.

22..  FFiillee mmaanniippuullaattiioonn

22..11..  CCuurrrreenntt ffiillee

     _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


22..22..  AAlltteerrnnaattee ffiillee

     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.

22..33..  FFiilleennaammee eexxppaannssiioonn

     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.

22..44..  MMuullttiippllee ffiilleess aanndd nnaammeedd bbuuffffeerrss

     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_.

22..55..  RReeaadd oonnllyy

     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 --RR 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


33..  EExxcceeppttiioonnaall CCoonnddiittiioonnss

33..11..  EErrrroorrss aanndd iinntteerrrruuppttss

     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.

33..22..  RReeccoovveerriinngg ffrroomm hhaanngguuppss aanndd ccrraasshheess

     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 --rr 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

     eexx --rr _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

     eexx -rr

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

44..  EEddiittiinngg mmooddeess

     _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_.

55..  CCoommmmaanndd ssttrruuccttuurree

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

55..11..  CCoommmmaanndd ppaarraammeetteerrss

     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.

55..22..  CCoommmmaanndd vvaarriiaannttss

     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.

55..33..  FFllaaggss aafftteerr ccoommmmaannddss

     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


55..44..  CCoommmmeennttss

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

55..55..  MMuullttiippllee ccoommmmaannddss ppeerr lliinnee

     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 `|'.

55..66..  RReeppoorrttiinngg llaarrggee cchhaannggeess

     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.

66..  CCoommmmaanndd aaddddrreessssiinngg

66..11..  AAddddrreessssiinngg pprriimmiittiivveess

..                   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'.

66..22..  CCoommbbiinniinngg aaddddrreessssiinngg pprriimmiittiivveess

     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.

77..  CCoommmmaanndd ddeessccrriippttiioonnss

     The following form is a prototype for all _e_x commands:

     _a_d_d_r_e_s_s ccoommmmaanndd _! _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.


aabbbbrreevviiaattee _w_o_r_d _r_h_s                     abbr: aabb


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


( .. ) aappppeenndd                            abbr: aa
_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.


aa!!
_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_.


aarrggss

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


( .. , .. ) cchhaannggee _c_o_u_n_t                  abbr: cc
_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.


cc!!
_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_.


( .. , .. )ccooppyy _a_d_d_r _f_l_a_g_s                abbr: ccoo

     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


( .. , .. )ddeelleettee _b_u_f_f_e_r _c_o_u_n_t _f_l_a_g_s      abbr: dd

     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.


eeddiitt _f_i_l_e                               abbr: ee
eexx _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.


ee!! _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.


ee ++_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


ffiillee                                    abbr: ff

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


ffiillee _f_i_l_e

     The current file name is changed to _f_i_l_e which is considered
     `[Not edited]'.


( 1 , $ ) gglloobbaall /_p_a_t/ _c_m_d_s             abbr: gg

     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_.


gg!! //_p_a_t// _c_m_d_s                           abbr: vv

     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 ww!! to write
to the file, since the editor is not sure that a wwrriittee  will  not
destroy a file unrelated to the current contents of the buffer.









Ex Reference Manual                                     USD:12-11


( .. )iinnsseerrtt                             abbr: ii
_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.


ii!!
_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 ) jjooiinn _c_o_u_n_t _f_l_a_g_s            abbr: jj

     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.


jj!!

     The variant causes a simpler _j_o_i_n with no white  space  pro-
     cessing;  the  characters  in  the lines are simply concate-
     nated.


( .. ) kk _x

     The _k command is a synonym for _m_a_r_k_.  It does not require  a
     blank or tab before the following letter.


( .. , .. ) lliisstt _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.


mmaapp _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.


( .. ) mmaarrkk _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.


( .. , .. ) mmoovvee _a_d_d_r                     abbr: mm

     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.


nneexxtt                                    abbr: nn

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


nn!!

     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.


nn _f_i_l_e_l_i_s_t
nn ++_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.


( .. , .. ) nnuummbbeerr _c_o_u_n_t _f_l_a_g_s            abbr: ## or nnuu

     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


( .. ) ooppeenn _f_l_a_g_s                        abbr: oo
( .. ) ooppeenn /_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.


pprreesseerrvvee

     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.


( .. , .. )pprriinntt _c_o_u_n_t                    abbr: pp or PP

     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.


( .. )ppuutt _b_u_f_f_e_r                         abbr: ppuu

     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.


qquuiitt                                    abbr: qq

     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 qq!! 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


qq!!

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


( .. ) rreeaadd _f_i_l_e                         abbr: rr

     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.


( .. ) rreeaadd  !!_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.


rreeccoovveerr _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.


rreewwiinndd                                  abbr: rreeww

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


rreeww!!


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


sseett _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.


sshheellll                                   abbr: sshh

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


ssoouurrccee _f_i_l_e                             abbr: ssoo

     Reads and executes commands from the specified file.  _S_o_u_r_c_e
     commands may be nested.


( .. , .. ) ssuubbssttiittuuttee /_p_a_t/_r_e_p_l/ _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_sabbr: ss

     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


ssttoopp

     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 ssttoopp!   is  used.   This
     commands  is  only available where supported by the teletype
     driver and operating system.


( .. , .. ) ssuubbssttiittuuttee _o_p_t_i_o_n_s _c_o_u_n_t _f_l_a_g_sabbr: ss

     If _p_a_t and _r_e_p_l are omitted, then the last  substitution  is
     repeated.  This is a synonym for the && command.


( .. , .. ) tt _a_d_d_r _f_l_a_g_s

     The _t command is a synonym for _c_o_p_y.


ttaa _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.


uunnaabbbbrreevviiaattee _w_o_r_d                       abbr: uunnaa

     Delete _w_o_r_d from the list of abbreviations.


uunnddoo                                    abbr: uu

     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_.


uunnmmaapp _l_h_s

     The macro expansion associated by _m_a_p for _l_h_s is removed.


( 1 , $ ) vv /_p_a_t/ _c_m_d_s

     A synonym for the _g_l_o_b_a_l command  variant  gg!!,  running  the
     specified _c_m_d_s on each line which does not match _p_a_t.


vveerrssiioonn                                 abbr: vvee

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


( .. ) vviissuuaall _t_y_p_e _c_o_u_n_t _f_l_a_g_s           abbr: vvii

     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.


vviissuuaall file
vviissuuaall +_n file

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


( 1 , $ ) wwrriittee _f_i_l_e                    abbr: ww

     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 , $ ) wwrriittee>>>> _f_i_l_e                  abbr: ww>>>>

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



ww!! _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 , $ ) ww  !!_c_o_m_m_a_n_d

     Writes the specified lines into _c_o_m_m_a_n_d_.  Note  the  differ-
     ence between ww!! which overrides checks and ww  !! which writes
     to a command.


wwqq _n_a_m_e

     Like a _w_r_i_t_e and then a _q_u_i_t command.


wwqq!! _n_a_m_e

     The variant overrides checking on  the  sensibility  of  the
     _w_r_i_t_e command, as ww!! does.


xxiitt _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 ww!! to force the write.









Ex Reference Manual                                     USD:12-19


( .. , .. )yyaannkk _b_u_f_f_e_r _c_o_u_n_t              abbr: yyaa

     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.


( ..++11 ) zz _c_o_u_n_t

     Print the next _c_o_u_n_t lines, default _w_i_n_d_o_w.


( .. ) zz _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.


^^DD

     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.

88..  RReegguullaarr eexxpprreessssiioonnss aanndd ssuubbssttiittuuttee rreeppllaacceemmeenntt ppaatttteerrnnss

88..11..  RReegguullaarr eexxpprreessssiioonnss

     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 `??'.

88..22..  MMaaggiicc aanndd nnoommaaggiicc

     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_.

88..33..  BBaassiicc rreegguullaarr eexxpprreessssiioonn ssuummmmaarryy

     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  `\'.

88..44..  CCoommbbiinniinngg rreegguullaarr eexxpprreessssiioonn pprriimmiittiivveess

     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.

88..55..  SSuubbssttiittuuttee rreeppllaacceemmeenntt ppaatttteerrnnss

     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.

99..  OOppttiioonn ddeessccrriippttiioonnss



aauuttooiinnddeenntt, aaii                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 ^^DD.  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 ^^DD.

     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 ^^DD.  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 ^^DD 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.


aauuttoopprriinntt, aapp                 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


aauuttoowwrriittee, aaww                 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 nnoott 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 ::ee ## and a ::ttaa!!
     command from within _v_i_s_u_a_l_)_.


bbeeaauuttiiffyy, bbff                  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.


ddiirreeccttoorryy, ddiirr                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.


eeddccoommppaattiibbllee                  default: noedcompatible

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


eerrrroorrbbeellllss, eebb                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.


hhaarrddttaabbss, hhtt                  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


iiggnnoorreeccaassee, iicc                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.


lliisspp                          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.


lliisstt                          default: nolist

     All  printed  lines  will be displayed (more) unambiguously,
     showing tabs and end-of-lines as in the _l_i_s_t command.


mmaaggiicc                         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 `\'.


mmeessgg                          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.


mmooddeelliinnee                      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 eexx:: or vvii:: 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_.


nnuummbbeerr,, nnuu                    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.


ooppeenn                          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.


ooppttiimmiizzee,, oopptt                 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.


ppaarraaggrraapphhss,, ppaarraa              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.


pprroommpptt                        default: prompt

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


rreeddrraaww                        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.


rreemmaapp                         default: remap

     If on, macros are repeatedly tried until they are unchanged.
     For example, if oo is mapped to OO, and OO is mapped to II, then
     if  _r_e_m_a_p is set, oo will map to II, but if _n_o_r_e_m_a_p is set, it
     will map to OO.


rreeppoorrtt                        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.


ssccrroollll                        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).


sseeccttiioonnss                      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.


sshheellll, sshh                     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.


sshhiiffttwwiiddtthh, ssww                default: sw=8

     Gives the width a software tab stop, used in reverse tabbing
     with ^^DD when using _a_u_t_o_i_n_d_e_n_t to append  text,  and  by  the
     shift commands.


sshhoowwmmaattcchh,, ssmm                 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_.


sslloowwooppeenn,, ssllooww                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


ttaabbssttoopp,, ttss                   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.


ttaagglleennggtthh,, ttll                 default: tl=0

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


ttaaggss                          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 ttaaggss are searched
     for in the current directory and in /usr/lib (a master  file
     for the entire system).


tteerrmm                          from environment TERM

     The terminal type of the output device.


tteerrssee                         default: noterse

     Shorter  error  diagnostics are produced for the experienced
     user.


wwaarrnn                          default: warn

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


wwiinnddooww                        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.


ww330000,, ww11220000 ww99660000

     These are not true options but set wwiinnddooww 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


wwrraappssccaann, wwss                  default: ws

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


wwrraappmmaarrggiinn, wwmm                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.


wwrriitteeaannyy, wwaa                  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.

1100..  AAcckknnoowwlleeddggeemmeennttss

     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.

































