Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ edit(1) — 4D1 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

awk(1)

ed(1)

edit(1)

grep(1)

sed(1)

vi(1)

curses(3X)

term(4)

terminfo(4)



     EX(1)                                                       EX(1)



     NAME
          ex - text editor

     SYNOPSIS
          ex [ - ] [ -v ] [ -t tag ] [ -r ] [ -R ] [ -x ] [ +command ]
          name ...

     DESCRIPTION
          ex is the root of a family of editors:  ex and vi. ex is a
          superset of ed, with the most notable extension being a
          display editing facility.  Display based editing is the
          focus of vi.

          If you have a CRT terminal, you may wish to use a display
          based editor; in this case see vi(1), which is a command
          which focuses on the display editing portion of ex.

        For ed Users
          If you have used ed you will find that ex has a number of
          new features useful on CRT terminals.  Intelligent terminals
          and high speed terminals are very pleasant to  use with vi.
          Generally, the editor uses far more of the capabilities of
          terminals than ed does, and uses the terminal capability
          data base (see Terminal Information Utilities Guide) and the
          type of the terminal you are using from the variable TERM in
          the environment to determine how to drive your terminal
          efficiently.  The editor makes use of features such as
          insert and delete character and line in its visual command
          (which can be abbreviated vi) and which is the central mode
          of editing when using vi(1).

          ex contains a number of new features for easily viewing the
          text of the file.  The z command gives easy access to
          windows of text.  Hitting ^D causes the editor to scroll a
          half-window of text and is more useful for quickly stepping
          through a file than just hitting return.  Of course, the
          screen-oriented visual mode gives constant access to editing
          context.

          ex gives you more help when you make mistakes.  The undo (u)
          command allows you to reverse any single change which goes
          astray.  ex gives you a lot of feedback, normally printing
          changed lines, and indicates when more than a few lines are
          affected by a command so that it is easy to detect when a
          command has affected more lines than it should have.

          The editor also normally prevents overwriting existing files
          unless you edited them so that you do not accidentally
          clobber with a write a file other than the one you are
          editing.  If the system (or editor) crashes, or you
          accidentally hang up the telephone, you can use the editor
          recover command to retrieve your work.  This will get you



     Page 1                                        (last mod. 8/20/87)





     EX(1)                                                       EX(1)



          back to within a few lines of where you left off.

          ex has several features for dealing with more than one file
          at a time.  You can give it a list of files on the command
          line and use the next (n) command to deal with each in turn.
          The next command can also be given a list of file names, or
          a pattern as used by the shell to specify a new set of files
          to be dealt with.  In general, file names in the editor may
          be formed with full shell metasyntax.  The metacharacter `%'
          is also available in forming file names and is replaced by
          the name of the current file.

          For moving text between files and within a file the editor
          has a group of buffers, named a through z. You can place
          text in these named buffers and carry it over when you edit
          another file.

          There is a command & in ex which repeats the last substitute
          command.  In addition there is a confirmed substitute
          command.  You give a range of substitutions to be done and
          the editor interactively asks whether each substitution is
          desired.

          It is possible to ignore case of letters in searches and
          substitutions.  ex also allows regular expressions which
          match words to be constructed.  This is convenient, for
          example, in searching for the word ``edit'' if your document
          also contains the word ``editor.''

          ex has a set of options which you can set to tailor it to
          your liking.  One option which is very useful is the
          autoindent option which allows the editor to automatically
          supply leading white space to align text.  You can then use
          the ^D key as a backtab and space and tab forward to align
          new code easily.

          Miscellaneous new useful features include an intelligent
          join (j) command which supplies white space between joined
          lines automatically, commands < and > which shift groups of
          lines, and the ability to filter portions of the buffer
          through commands such as sort.

      INVOCATION OPTIONS
          The following invocation options are interpreted by ex:

          -              Suppress all interactive-user feedback.  This
                         is useful in processing editor scripts.

          -v             Invokes vi

          -t tagfR       Edit the file containing the tag and position
                         the editor at its definition.



     Page 2                                        (last mod. 8/20/87)





     EX(1)                                                       EX(1)



          -r file        Recover file after an editor or system crash.
                         If file is not specified a list of all saved
                         files will be printed.

          -R             Readonly mode set, prevents accidentally
                         overwriting the file.

          -x             Encryption option; when this option is used,
                         the file will be encrypted as it is being
                         written and will require an encryption key to
                         be read (see crypt(1)).  Also, see the
                         WARNING section at the end of this manual
                         page.

          +command       Begin editing by executing the specified
                         editor search or positioning command.

          The name argument indicates files to be edited.

        ex States
          Command        Normal and initial state.  Input prompted for
                         by :.  Your kill character cancels partial
                         command.

          Insert         Entered by a, i, or c.  Arbitrary text may be
                         entered.  Insert is  normally terminated by a
                         line having only .  on it, or abnormally with
                         an interrupt.

          Visual         Entered by vi, terminates with Q or ^\.

        ex command names and abbreviations
          abbrev   ab   next         n     unabbrev     una
          append   a    number       nu    undo         u
          args     ar                      unmap        unm
          change   c    preserve     pre   version      ve
          copy     co   print        p     visual       vi
          delete   d    put          pu    write        w
          edit     e    quit         q     xit          x
          file     f    read         re    yank         ya
          global   g    recover      rec   window       z
          insert   i    rewind       rew   escape       !
          join     j    set          se    lshift       <
          list     l    shell        sh    print next   CR
          map           source       so    resubst      &
          mark     ma   stop         st    rshift       >
          move     m    substitute   s     scroll       ^D

        ex Command Addresses
          n     line n      /pat   next with pat





     Page 3                                        (last mod. 8/20/87)





     EX(1)                                                       EX(1)



          .     current     ?pat   previous with pat
          $     last        x-n    n before x
          +     next        x,y    x through y
          -     previous    'x     marked with x
          +n    n forward   ''     previous context
          %     1,$

        Initializing options
          EXINIT         place set's here in environment var.
          $HOME/.exrc    editor initialization file
          ./.exrc        editor initialization file
          set x          enable option
          set nox        disable option
          set x=val      give value val
          set            show changed options
          set all        show all options
          set x?         show value of option x

        Most useful options
          autoindent   ai     supply indent
          autowrite    aw     write before changing files
          ignorecase   ic     in scanning
          list                print ^I for tab, $ at end
          magic               . [ * special in patterns
          number       nu     number lines
          paragraphs   para   macro names which start ...
          redraw              simulate smart terminal
          scroll              command mode lines
          sections     sect   macro names ...
          shiftwidth   sw     for < >, and input ^D
          showmatch    sm     to ) and } as typed
          showmode     smd    show insert mode in vi
          slowopen     slow   stop updates during insert
          window              visual mode lines
          wrapscan     ws     around end of buffer?
          wrapmargin   wm     automatic line splitting

        Scanning pattern formation
           ^           beginning of line
           $           end of line
           .           any character
           \<          beginning of word
           \>          end of word
           [str]       any char in str
           [^str]      ... not in str
           [x-y]       ... between x and y
           *           any number of preceding

     AUTHOR
          Vi and ex are based on software developed by The University
          of California, Berkeley California, Computer Science
          Division, Department of Electrical Engineering and Computer



     Page 4                                        (last mod. 8/20/87)





     EX(1)                                                       EX(1)



          Science.

     FILES
          /usr/lib/ex?.?strings     error messages
          /usr/lib/ex?.?recover     recover command
          /usr/lib/ex?.?preserve    preserve command
          /usr/lib/*/*              describes capabilities of terminals
          $HOME/.exrc               editor startup file
          ./.exrc                   editor startup file
          /tmp/Exnnnnn              editor temporary
          /tmp/Rxnnnnn              named buffer temporary
          /usr/preserve/login       preservation directory
                                    (where login is the user's login)

     SEE ALSO
          awk(1), ed(1), edit(1), grep(1), sed(1), vi(1).
          curses(3X), term(4), terminfo(4) in the Programmer's
          Reference Manual.

     WARNING
          The -x option is provided with the Security Administration
          Utilities, which is available only in the United States.

     BUGS
          The undo command causes all marks to be lost on lines
          changed and then restored if the marked lines were changed.

          Undo never clears the buffer modified condition.

          The z command prints a number of logical rather than
          physical lines.  More than a screen full of output may
          result if long lines are present.

          File input/output errors do not print a name if the command
          line `-' option is used.

          There is no easy way to do a single scan ignoring case.

          The editor does not warn if text is placed in named buffers
          and not used before exiting the editor.

          Null characters are discarded in input files and cannot
          appear in resultant files.

     ORIGIN
          AT&T V.3









     Page 5                                        (last mod. 8/20/87)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026