home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 365_03 / elvisman.txt < prev    next >
Text File  |  1992-04-06  |  197KB  |  5,413 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                   #######
  8.                   #        #       #    #     #     ####
  9.                   #        #       #    #     #    #
  10.                   #####    #       #    #     #     ####
  11.                   #        #       #    #     #         #
  12.                   #        #        #  #      #    #    #
  13.                   #######  ######    ##       #     ####
  14.  
  15.                             - a clone of vi/ex -
  16.                                 version 1.5
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.   Author:  Steve Kirkendall
  48.            14407 SW Teal Blvd., Apt C
  49.            Beaverton, OR 97005
  50.  
  51.   E-Mail:  kirkenda@cs.pdx.edu
  52.  
  53.   Phone:   (503) 643-6980
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.                                March 23, 1992
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                              Table of Contents
  77.  
  78.  
  79.  
  80.  
  81.         INTRODUCTION What ELVIS does, Copyright, How to com-
  82.         pile ELVIS, Overview ..................................    1
  83.  
  84.         VISUAL MODE COMMANDS Normal interactive editing,
  85.         Input mode, Arrow keys, Digraphs, Abbreviations,
  86.         Auto-indentation ......................................    2
  87.  
  88.         COLON MODE COMMANDS Line specifiers, Text entry, Cut
  89.         & paste, Display text, Global operations, Line edit-
  90.         ing, Undo, Configuration & status, Multiple files,
  91.         Switching files, Working with a compiler, Exiting,
  92.         File I/O, Directory & shell, Debugging ................    3
  93.  
  94.         REGULAR EXPRESSIONS Syntax, Options, Substitutions,
  95.         Examples ..............................................    4
  96.  
  97.         OPTIONS Autoindent, Autoprint, etc.  ..................    5
  98.  
  99.         CUT BUFFERS Putting text into a cut buffer, Pasting
  100.         from a cut buffer, Macros, The effect of switching
  101.         files .................................................    6
  102.  
  103.         DIFFERENCES BETWEEN ELVIS AND THE REAL VI/EX Exten-
  104.         sions, Omissions ......................................    7
  105.  
  106.         INTERNAL For programmers only, The temporary file,
  107.         Implementation of editing, Marks and the cursor,
  108.         Colon command interpretation, Screen control, Porta-
  109.         bility ................................................    8
  110.  
  111.         CFLAGS ................................................    9
  112.  
  113.         TERMCAP ...............................................   10
  114.  
  115.         ENVIRONMENT VARIABLES .................................   11
  116.  
  117.         VERSIONS ..............................................   12
  118.  
  119.         QUESTIONS & ANSWERS ...................................   13
  120.  
  121.  
  122.           UNIX-style "man" pages appear at the end of this manual.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                March 23, 1992
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.         1.  INTRODUCTION
  140.  
  141.              Elvis is a clone of vi/ex, the  standard  UNIX  editor.
  142.         Elvis  supports  nearly  all  of the vi/ex commands, in both
  143.         visual mode and colon mode.
  144.  
  145.              Like vi/ex, Elvis stores most of the  text  in  a  tem-
  146.         porary  file,  instead of RAM.  This allows it to edit files
  147.         that are too large to fit in a single process'  data  space.
  148.         Also, the edit buffer can survive a power failure or crash.
  149.  
  150.              Elvis runs under BSD UNIX, AT&T SysV UNIX,  Minix,  MS-
  151.         DOS,  Atari TOS, Coherent, OS9/68000, VMS and AmigaDos.  The
  152.         next version is also expected to add  MS-Windows,  OS/2  and
  153.         MacOS.  Contact me before you start porting it to some other
  154.         OS, because somebody else may have already done it for you.
  155.  
  156.              Elvis is freely redistributable, in either source  form
  157.         or  executable  form.   There are no restrictions on how you
  158.         may use it.
  159.  
  160.         1.1.  Compiling
  161.  
  162.              See the "Versions" section of this manual for  instruc-
  163.         tions on how to compile Elvis.
  164.  
  165.              If you want to port Elvis to another O.S. or  compiler,
  166.         then  you  should start by reading the "Portability" part of
  167.         the "Internal" section.
  168.  
  169.         1.2.  Overview of Elvis
  170.  
  171.              The user interface of Elvis/vi/ex is weird.  There  are
  172.         two major command modes in Elvis, and a few text input modes
  173.         as well.  Each command mode has a command which  allows  you
  174.         to switch to the other mode.
  175.  
  176.              You will probably use the visual command mode  most  of
  177.         the  time.   This  is the mode that Elvis normally starts up
  178.         in.
  179.  
  180.              In visual command mode, the  entire  screen  is  filled
  181.         with lines of text from your file.  Each keystroke is inter-
  182.         pretted as part of a visual command.  If  you  start  typing
  183.         text, it will not be inserted, it will be treated as part of
  184.         a command.  To insert text, you must first give  an  "insert
  185.         text"  command.   This  will take some getting used to.  (An
  186.         alternative exists.  Lookup the "inputmode" option.)
  187.  
  188.              The colon mode is quite different.   Elvis  displays  a
  189.         ":" character on the bottom line of the screen, as a prompt.
  190.         You are then expected to type in a command line and hit  the
  191.         <Return>  key.   The set of commands recognized in the colon
  192.         mode is different from visual mode's.
  193.  
  194.  
  195.  
  196.                                March 23, 1992
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.         2.  VISUAL MODE COMMANDS
  206.  
  207.              Most visual mode commands are one keystroke long.   The
  208.         following  table lists the operation performed by each keys-
  209.         troke, and also denotes any options  or  arguments  that  it
  210.         accepts.   Notes  at the end of the table describe the nota-
  211.         tion used in this table.
  212.  
  213.              In addition to the keys listed  here,  your  keyboard's
  214.         "arrow"  keys will be interpretted as the appropriate cursor
  215.         movement commands.  The same goes for <PgUp> and <PgDn>,  if
  216.         your  keyboard  has  them.   The  <Insert>  key  will toggle
  217.         between insert mode and replace mode.  There is a colon mode
  218.         command (":map", to be described later) which will allow you
  219.         to define other keys, such as function keys.
  220.  
  221.              A tip: visual command mode looks a lot like text  input
  222.         mode.   If  you  forget  which  mode you're in, just hit the
  223.         <Esc> key.  If Elvis beeps, then you're  in  visual  command
  224.         mode.   If Elvis does not beep, then you were in input mode,
  225.         but by hitting <Esc> you will have switched to  visual  com-
  226.         mand  mode.   So, one way or another, after <Esc> Elvis will
  227.         be ready for a command.
  228.  
  229.         COMMAND      DESCRIPTION
  230.                ^A    Search for next occurence of word at cursor (MOVE)(EXT)
  231.                ^B    Move toward the top of the file by 1 screenful
  232.                ^C    --- (usually sends SIGINT, to interupt a command)
  233.         count  ^D    Scroll down <count> lines (default 1/2 screen)
  234.         count  ^E    Scroll up <count> lines
  235.                ^F    Move toward the bottom of the file by 1 screenful
  236.                ^G    Show file status, and the current line #
  237.         count  ^H    Move left, like h (MOVE)
  238.                ^I    ---
  239.         count  ^J    Move down (MOVE)
  240.                ^K    ---
  241.                ^L    Redraw the screen
  242.         count  ^M    Move to the front of the next line (MOVE)
  243.         count  ^N    Move down (MOVE)
  244.                ^O    ---
  245.         count  ^P    Move up (MOVE)
  246.                ^Q    --- (typically XON, which restarts screen updates)
  247.                ^R    Redraw the screen
  248.                ^S    --- (typically XOFF, which stops screen updates)
  249.                ^T    ---
  250.         count  ^U    Scroll up <count> lines (default 1/2 screen)
  251.                ^V    ---
  252.                ^W    ---
  253.         count  ^X    Move to a physical column number on the screen (MOVE) (EXT)
  254.         count  ^Y    Scroll down <count> lines
  255.                ^Z    --- (sometimes sends SIGSUSP, to suspend execution)
  256.                ESC   ---
  257.                ^\    --- (usually sends SIGQUIT, which is ignored)
  258.                ^]    If the cursor is on a tag name, go to that tag
  259.  
  260.  
  261.  
  262.                                March 23, 1992
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         2-2                 VISUAL MODE COMMANDS                 2-2
  269.  
  270.  
  271.                ^^    Switch to the previous file, like ":e #"
  272.                ^_    ---
  273.         count  SPC   Move right,like l (MOVE)
  274.                ! mv  Run the selected lines thru an external filter program
  275.                " key Select which cut buffer to use next
  276.         count  # +   Increment a number (EDIT) (EXT)
  277.                $     Move to the rear of the current line (MOVE)
  278.         count  %     Move to matching (){}[] or to a given % of file (MOVE)(EXT)
  279.         count  &     Repeat the previous ":s//" command here (EDIT)
  280.                ' key Move to a marked line (MOVE)
  281.         count  (     Move backward <count> sentences (MOVE)
  282.         count  )     Move forward <count> sentences (MOVE)
  283.                *     Go to the next error in the errlist (EXT)
  284.         count  +     Move to the front of the next line (MOVE)
  285.         count  ,     Repeat the previous [fFtT] but in the other direction(MOVE)
  286.         count  -     Move to the front of the preceding line (MOVE)
  287.         count  .     Repeat the previous "edit" command
  288.                / textSearch forward for a given regular expression (MOVE)
  289.                0     If not part of count, move to 1st char of this line (MOVE)
  290.                1     Part of count
  291.                2     Part of count
  292.                3     Part of count
  293.                4     Part of count
  294.                5     Part of count
  295.                6     Part of count
  296.                7     Part of count
  297.                8     Part of count
  298.                9     Part of count
  299.                : textRun single EX cmd
  300.         count  ;     Repeat the previous [fFtT] cmd (MOVE)
  301.                < mv  Shift text left (EDIT)
  302.                = mv  Reformat
  303.                > mv  Shift text right (EDIT)
  304.                ? textSearch backward for a given regular expression (MOVE)
  305.                @ key Execute the contents of a cut-buffer as VI commands
  306.         count  A inp Append at end of the line (EDIT)
  307.         count  B     Move back Word (MOVE)
  308.                C inp Change text from the cursor through the end-of-line (EDIT)
  309.                D     Delete text from the cursor through the end-of-line (EDIT)
  310.         count  E     Move end of Word (MOVE)
  311.         count  F key Move leftward to a given character (MOVE)
  312.         count  G     Move to line #<count> (default is the bottom line) (MOVE)
  313.         count  H     Move to home row (the line at the top of the screen)
  314.         count  I inp Insert at the front of the line (after indents) (EDIT)
  315.         count  J     Join lines, to form one big line (EDIT)
  316.                K     Look up keyword (EXT)
  317.         count  L     Move to last row (the line at the bottom of the screen)
  318.                M     Move to middle row
  319.                N     Repeat previous search, but in the opposite direction(MOVE)
  320.         count  O inp Open up a new line above the current line (EDIT)
  321.                P     Paste text before the cursor (EDIT)
  322.                Q     Quit to EX mode
  323.                R inp Overtype (EDIT)
  324.         count  S inp Change lines, like <count>cc
  325.  
  326.  
  327.  
  328.                                March 23, 1992
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         2-3                 VISUAL MODE COMMANDS                 2-3
  335.  
  336.  
  337.         count  T key Move leftward *almost* to a given character (MOVE)
  338.                U     Undo all recent changes to the current line
  339.                V     Start marking lines for c/d/y/</>/!/\ (EXT)
  340.         count  W     Move forward <count> Words (MOVE)
  341.         count  X     Delete the character(s) to the left of the cursor (EDIT)
  342.         count  Y     Yank text line(s) (copy them into a cut buffer)
  343.                Z Z   Save the file & exit
  344.                [ [   Move back 1 section (MOVE)
  345.                \ mv  Pop-up menu for modifying text (EXT)
  346.                ] ]   Move forward 1 section (MOVE)
  347.                ^     Move to the front of the current line (after indent) (MOVE)
  348.         count  _     Move to the current line
  349.                ` key Move to a marked character (MOVE)
  350.         count  a inp Insert text after the cursor (EDIT)
  351.         count  b     Move back <count> words (MOVE)
  352.                c mv  Change text (EDIT)
  353.                d mv  Delete text (EDIT)
  354.         count  e     Move forward to the end of the current word (MOVE)
  355.         count  f key Move rightward to a given character (MOVE)
  356.                g     ---
  357.         count  h     Move left (MOVE)
  358.         count  i inp Insert text at the cursor (EDIT)
  359.         count  j     Move down (MOVE)
  360.         count  k     Move up (MOVE)
  361.         count  l     Move right (MOVE)
  362.                m key Mark a line or character
  363.                n     Repeat the previous search (MOVE)
  364.         count  o inp Open a new line below the current line (EDIT)
  365.                p     Paste text after the cursor (EDIT)
  366.                q     ---
  367.         count  r key Replace <count> chars by a given character (EDIT)
  368.         count  s inp Replace <count> chars with text from the user (EDIT)
  369.         count  t key Move rightward *almost* to a given character (MOVE)
  370.                u     Undo the previous edit command
  371.                v     Start marking characters for c/d/y/</>/!/\ (EXT)
  372.         count  w     Move forward <count> words (MOVE)
  373.         count  x     Delete the character that the cursor's on (EDIT)
  374.                y mv  Yank text (copy it into a cut buffer)
  375.                z key Scroll current line to the screen's +=top -=bottom .=middle
  376.         count  {     Move back <count> paragraphs (MOVE)
  377.         count  |     Move to column <count> (the leftmost column is 1)
  378.         count  }     Move forward <count> paragraphs (MOVE)
  379.         count  ~     Switch a character between uppercase & lowercase (EDIT)
  380.                DEL   --- (usually mapped to shift-X, so it deletes 1 character)
  381.  
  382.  
  383.         count
  384.              Many commands may be preceded by a count.   This  is  a
  385.              sequence  of digits representing a decimal number.  For
  386.              most commands that use a count, the command is repeated
  387.              <count>  times.  The count is always optional, and usu-
  388.              ally defaults to 1.
  389.  
  390.         key  Some commands require two keystrokes.   The  first  key
  391.  
  392.  
  393.  
  394.                                March 23, 1992
  395.  
  396.  
  397.  
  398.  
  399.  
  400.         2-4                 VISUAL MODE COMMANDS                 2-4
  401.  
  402.  
  403.              always determines which command is to be executed.  The
  404.              second key is used as a parameter to the command.
  405.  
  406.         mv   Some commands (! < > c d y \ =) operate on text between
  407.              the  cursor  and  some other position.  There are three
  408.              ways that you can specifify that other position.
  409.  
  410.              The first way is to follow the command keystroke with a
  411.              movement  command.   For example, "dw" deletes a single
  412.              word.  "d3w" and "3dw" both delete three words.
  413.  
  414.              The second way is to type the command keystroke  twice.
  415.              This causes whole lines to be acted upon.  For example,
  416.              ">>" indents  the  current  line.   "3>>"  indents  the
  417.              current line and the following two lines.
  418.  
  419.              The last way is to move the cursor to one  end  of  the
  420.              text, type 'v' or 'V' to start marking, move the cursor
  421.              to the other end, and then  type  the  desired  command
  422.              key.
  423.  
  424.         inp  Many commands allow the  user  to  interactively  enter
  425.              text.   See  the discussion of "input mode" in the fol-
  426.              lowing section.
  427.  
  428.         (EXT)
  429.              These commands are extensions -- the  real  vi  doesn't
  430.              have them.
  431.  
  432.         (EDIT)
  433.              These commands affect text, and may be repeated by  the
  434.              "." command.
  435.  
  436.         (MOVE)
  437.              These commands move the cursor,  and  may  be  used  to
  438.              specify  the  extent  of  a member of the "mv" class of
  439.              commands.
  440.  
  441.         2.1.  Input Mode
  442.  
  443.              You can't type text into your file directly from visual
  444.         command  mode.  Instead, you must first give a command which
  445.         will put you into input mode.  The commands to do  this  are
  446.         A/C/I/O/R/S/a/i/o/s.
  447.  
  448.              The S/s/C/c commands temporarily place a $ at  the  end
  449.         of the text that they are going to change.
  450.  
  451.              In input mode, all keystrokes  are  inserted  into  the
  452.         text at the cursor's position, except for the following:
  453.  
  454.                 ^A      insert a copy of the last input text
  455.                 ^D      delete one indent character
  456.                 ^H      (backspace) erase the character before the cursor
  457.  
  458.  
  459.  
  460.                                March 23, 1992
  461.  
  462.  
  463.  
  464.  
  465.  
  466.         2-5                 VISUAL MODE COMMANDS                 2-5
  467.  
  468.  
  469.                 ^L      redraw the screen
  470.                 ^M      (carriage return) insert a newline (^J, linefeed)
  471.                 ^O      execute next key as a visual command (limited!)
  472.                 ^P      insert the contents of the cut buffer
  473.                 ^R      redraw the screen, like ^L
  474.                 ^T      insert an indent character
  475.                 ^U      backspace to the beginning of the line
  476.                 ^V      insert the following keystroke, even if special
  477.                 ^W      backspace to the beginning of the current word
  478.                 ^Z^Z    write the file & exit Elvis
  479.                 ^[      (ESCape) exit from input mode, back to command mode
  480.  
  481.  
  482.              Also, on some systems, ^S may stop output, ^Q may  res-
  483.         tart  output,  and  ^C  may interupt execution.  ^@ (the NUL
  484.         character) cannot be inserted.
  485.  
  486.              The R visual command puts you in overtype  mode,  which
  487.         is  a  slightly  different  form of input mode.  In overtype
  488.         mode, each time you insert a character, one of the old char-
  489.         acters is deleted from the file.
  490.  
  491.         2.2.  Arrow keys in Input Mode
  492.  
  493.              The arrow keys can be used to move the cursor in  input
  494.         mode.   (This  is  an extension; the real Vi doesn't support
  495.         arrow keys in input mode.) The <PgUp>, <PgDn>,  <Home>,  and
  496.         <End>  keys  work  in  input  mode,  too.   The <Delete> key
  497.         deletes a single character in input mode.  The <Insert>  key
  498.         toggles between input mode and replace mode.
  499.  
  500.              The best thing about allowing arrow  keys  to  work  in
  501.         input  mode  is  that as long as you're in input mode, Elvis
  502.         seems to have a fairly ordinary user interface.   With  most
  503.         other  text editors, you are always in either insert mode or
  504.         replace mode, and you can use the arrow keys at any time  to
  505.         move  the  cursor.   Now,  Elvis can act like that, too.  In
  506.         fact, with the new "inputmode"  option  and  the  "control-Z
  507.         control-Z"  input  command,  you  may  never have to go into
  508.         visual command mode for simple edit sessions.
  509.  
  510.         2.3.  Digraphs
  511.  
  512.              Elvis supports digraphs as a  way  to  enter  non-ASCII
  513.         characters.   A  digraph is a character which is composed of
  514.         two other characters.  For example, an  apostrophe  and  the
  515.         letter i could be defined as a digraph which is to be stored
  516.         & displayed as an accented i.
  517.  
  518.              There is no single standard for extended ASCII  charac-
  519.         ter  sets.   Elvis  can be compiled to fill the digraph with
  520.         values appropriate for either the IBM PC character  set,  or
  521.         the  LATIN-1  character  set  used by X windows, or neither.
  522.         (See the discussions of -DCS_IBMPC and  -DCS_LATIN1  in  the
  523.  
  524.  
  525.  
  526.                                March 23, 1992
  527.  
  528.  
  529.  
  530.  
  531.  
  532.         2-6                 VISUAL MODE COMMANDS                 2-6
  533.  
  534.  
  535.         CFLAGS  section  of  this  manual.) You can view or edit the
  536.         digraph table via the ":digraph" colon command.
  537.  
  538.              Digraphs will not be recognized  until  you've  entered
  539.         ":set digraph".
  540.  
  541.              To actually use a digraph  type  the  first  character,
  542.         then  hit  <Backspace>,  and then type the second character.
  543.         Elvis will then substitute the non-ASCII character in  their
  544.         place.
  545.  
  546.         2.4.  Abbreviations
  547.  
  548.              Elvis can expand abbreviations for you.  You define  an
  549.         abbreviation  with  the :abbr command, and then whenever you
  550.         type in the abbreviated form while in input mode, Elvis will
  551.         immediately  replace  it with the long form.  COBOL program-
  552.         mers should find this useful. :-)
  553.  
  554.              Elvis doesn't perform the substitution until you type a
  555.         non-alphanumeric  character to mark the end of the word.  If
  556.         you type a control-V before that non-alphanumeric character,
  557.         then Elvis will not perform the substitution.
  558.  
  559.         2.5.  Auto-Indent
  560.  
  561.              With the ":set autoindent" option turned on, Elvis will
  562.         automatically  insert leading whitespace at the beginning of
  563.         each new line that you type in.  The leading  whitespace  is
  564.         copied from the preceding line.
  565.  
  566.              To add more leading  whitespace,  type  control-T.   To
  567.         remove some whitespace, type control-D.
  568.  
  569.              If you ":set noautotab", then the whitespace  generated
  570.         by  control-T  will  always consist of spaces -- never tabs.
  571.         Some people seem to prefer this.
  572.  
  573.              Elvis' autoindent mode isn't 100% compatible with vi's.
  574.         In  Elvis, 0^D and ^^D don't work, ^U can wipeout all inden-
  575.         tation, and sometimes Elvis will use a different  amount  of
  576.         indentation than vi would.
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                March 23, 1992
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.         3.  COLON MODE COMMANDS
  602.  
  603.                 LINES               COMMAND   ARGUMENTS
  604.                                     ab[br]    [short] [expanded form]
  605.                 [line]              a[ppend][!]
  606.                                     ar[gs]    [files]
  607.                                     cc        [files]
  608.                                     cd[!]     [directory]
  609.                 [line][,line]       c[hange]
  610.                                     chd[ir][!][directory]
  611.                 [line][,line]       co[py]    line
  612.                                     col[or]   [when] [[light] color] [on color]
  613.                 [line][,line]       d[elete]  [x]
  614.                                     dig[raph][!][XX [Y]]
  615.                                     e[dit][!] [file]
  616.                                     er[rlist][!][errlist]
  617.                                     f[ile]    [file]
  618.                 [line][,line]       g[lobal]  /regexp/ command
  619.                 [line]              i[nsert]
  620.                 [line][,line]       j[oin][!]
  621.                 [line][,line]       l[ist]
  622.                                     mak[e]    [target]
  623.                                     map[!]    key mapped_to
  624.                 [line]              ma[rk]    x
  625.                                     mk[exrc]
  626.                 [line][,line]       m[ove]    line
  627.                                     n[ext][!] [files]
  628.                                     N[ext][!]
  629.                 [line][,line]       nu[mber]
  630.                 [line][,line]       p[rint]
  631.                 [line]              pu[t]     [x]
  632.                                     q[uit][!]
  633.                 [line]              r[ead]    file
  634.                                     rew[ind][!]
  635.                                     se[t]     [options]
  636.                                     so[urce]  file
  637.                 [line][,line]       s[ubstitute]/regexp/replacement/[p][g][c]
  638.                                     ta[g][!]  tagname
  639.                                     una[bbr]  [short]
  640.                                     u[ndo]
  641.                                     unm[ap][!]key
  642.                                     ve[rsion]
  643.                 [line][,line]       v[global] /regexp/ command
  644.                                     vi[sual]  [filename]
  645.                                     wq
  646.                 [line][,line]       w[rite][!][[>>]file]
  647.                                     x[it][!]
  648.                 [line][,line]       y[ank]    [x]
  649.                 [line][,line]       !         command
  650.                 [line][,line]       <
  651.                 [line][,line]       =
  652.                 [line][,line]       >
  653.                 [line][,line]       &
  654.                                     @          x
  655.  
  656.  
  657.  
  658.                                March 23, 1992
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         3-2                 COLON MODE COMMANDS                  3-2
  665.  
  666.  
  667.              To use colon mode commands, you must switch from visual
  668.         command  mode  to  colon command mode.  The visual mode com-
  669.         mands to do this are ":" for a single colon command, or  "Q"
  670.         for many colon mode commands.
  671.  
  672.         3.1.  Line Specifiers
  673.  
  674.              Line specifiers are always optional.   The  first  line
  675.         specifier  of  most commands usually defaults to the current
  676.         line.  The second line specifier usually defaults to be  the
  677.         same  as  the  first line specifier.  Exceptions are :write,
  678.         :global, and :vglobal, which act on all lines of the file by
  679.         default, and :!, which acts on no lines by default.
  680.  
  681.              Line specifiers consist of an absolute part and a rela-
  682.         tive  part.   The  absolute  part of a line specifier may be
  683.         either an explicit line number, a mark, a dot to denote  the
  684.         current  line,  a dollar sign to denote the last line of the
  685.         file, or a forward or backward search.
  686.  
  687.              An explicit line number is  simply  a  decimal  number,
  688.         expressed as a string of digits.
  689.  
  690.              A mark is typed in  as  an  apostrophe  followed  by  a
  691.         letter.  Marks must be set before they can be used.  You can
  692.         set a mark in visual  command  mode  by  typing  "m"  and  a
  693.         letter,  or  you  can  set  it in colon command mode via the
  694.         "mark" command.
  695.  
  696.              A forward search is typed in as  a  regular  expression
  697.         surrounded  by  slash  characters;  searching  begins at the
  698.         default line.  A backward search is typed in  as  a  regular
  699.         expression surrounded by question marks; searching begins at
  700.         the line before the default line.
  701.  
  702.              If you omit the absolute part, then the default line is
  703.         used.
  704.  
  705.              The relative part of a line specifier is typed as a "+"
  706.         or  "-"  character followed by a decimal number.  The number
  707.         is added to or subtracted from the absolute part of the line
  708.         specifier to produce the final line number.
  709.  
  710.              As a special case, the  %  character  may  be  used  to
  711.         specify  all lines of the file.  It is roughly equivelent to
  712.         saying 1,$.  This can be a handy shortcut.
  713.  
  714.              Some examples:
  715.  
  716.              :p           print the current line
  717.              :37p         print line 37
  718.              :'gp         print the line which contains mark g
  719.              :/foo/p      print the next line that contains "foo"
  720.              :$p          print the last line of the file
  721.  
  722.  
  723.  
  724.                                March 23, 1992
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         3-3                 COLON MODE COMMANDS                  3-3
  731.  
  732.  
  733.              :20,30p      print lines 20 through 30
  734.              :1,$p        print all lines of the file
  735.              :%p          print all lines of the file
  736.              :/foo/-2,+4p print 5 lines around the next "foo"
  737.  
  738.  
  739.         3.2.  Text Entry Commands
  740.  
  741.                 [line] append
  742.                 [line][,line] change ["x]
  743.                 [line] insert
  744.  
  745.  
  746.              The append command inserts  text  after  the  specified
  747.         line.
  748.  
  749.              The insert command inserts text  before  the  specified
  750.         line.
  751.  
  752.              The change command copies the range of lines into a cut
  753.         buffer,  deletes  them,  and  inserts new text where the old
  754.         text used to be.
  755.  
  756.              For all of these commands, you indicate the end of  the
  757.         text  you're  inserting  by hitting ^D or by entering a line
  758.         which contains only a period.
  759.  
  760.         3.3.  Cut & Paste Commands
  761.  
  762.                 [line][,line] delete ["x]
  763.                 [line][,line] yank ["x]
  764.                 [line] put ["x]
  765.                 [line][,line] copy line
  766.                 [line][,line] to line
  767.                 [line][,line] move line
  768.  
  769.  
  770.              The delete command copies the specified range of  lines
  771.         into a cut buffer, and then deletes them.
  772.  
  773.              The yank command copies the specified  range  of  lines
  774.         into a cut buffer, but does *not* delete them.
  775.  
  776.              The put command inserts text from a  cut  buffer  after
  777.         the specified line.
  778.  
  779.              The copy and to commands yank the  specified  range  of
  780.         lines and then immediately paste them after some other line.
  781.  
  782.              The move command deletes the specified range  of  lines
  783.         and  then immediately pastes them after some other line.  If
  784.         the destination line comes after the deleted text,  then  it
  785.         will  be  adjusted  automatically to account for the deleted
  786.         lines.
  787.  
  788.  
  789.  
  790.                                March 23, 1992
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         3-4                 COLON MODE COMMANDS                  3-4
  797.  
  798.  
  799.         3.4.  Display Text Commands
  800.  
  801.                 [line][,line] print
  802.                 [line][,line] list
  803.                 [line][,line] number
  804.  
  805.  
  806.              The print  command  displays  the  specified  range  of
  807.         lines.
  808.  
  809.              The  number  command  displays  the  lines,  with  line
  810.         numbers.
  811.  
  812.              The list command also displays them, but it is  careful
  813.         to make control characters visible.
  814.  
  815.         3.5.  Global Operations Commands
  816.  
  817.                 [line][,line] global /regexp/ command
  818.                 [line][,line] vglobal /regexp/ command
  819.  
  820.  
  821.              The global command searches through the  lines  of  the
  822.         specified  range  (or  through the whole file if no range is
  823.         specified) for lines that contain a  given  regular  expres-
  824.         sion.   It  then moves the cursor to each of these lines and
  825.         runs some other command on them.
  826.  
  827.              The vglobal command is similar,  but  it  searches  for
  828.         lines that don't contain the regular expression.
  829.  
  830.         3.6.  Line Editing Commands
  831.  
  832.                 [line][,line] join[!]
  833.                 [line][,line] ! program
  834.                 [line][,line] <
  835.                 [line][,line] >
  836.                 [line][,line] substitute /regexp/replacement/[p][g][c]
  837.                 [line][,line] &
  838.  
  839.  
  840.              The join command catenates all lines in  the  specified
  841.         range  together to form one big line.  If only a single line
  842.         is specified, then the following line is catenated onto  it.
  843.         The  normal  ":join"  inserts  one or two spaces between the
  844.         lines; the ":join!" variation (with a  '!')  doesn't  insert
  845.         spaces.
  846.  
  847.              The ! command runs  an  external  filter  program,  and
  848.         feeds the specified range of lines to it's stdin.  The lines
  849.         are then replaced by the output of the  filter.   A  typical
  850.         example would be ":'a,'z!sort" to sort the lines 'a,'z.
  851.  
  852.              The < and > commands shift the specified range of lines
  853.  
  854.  
  855.  
  856.                                March 23, 1992
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         3-5                 COLON MODE COMMANDS                  3-5
  863.  
  864.  
  865.         left  or  right,  normally  by the width of 1 tab character.
  866.         The "shiftwidth" option determines the shifting amount.
  867.  
  868.              The substitute command finds the regular expression  in
  869.         each  line,  and replaces it with the replacement text.  The
  870.         "p" option causes the altered lines to be printed.  The  "g"
  871.         option permits all instances of the regular expression to be
  872.         found & replaced.  (Without "g", only the  first  occurrence
  873.         in each line is replaced.) The "c" option asks for confirma-
  874.         tion before each substitution.
  875.  
  876.              The & command repeats the  previous  substitution  com-
  877.         mand.   Actually, "&" is equivelent to "s//~/" with the same
  878.         options as last time.  It  searches  for  the  last  regular
  879.         expression  that you specified for any purpose, and replaces
  880.         it with the the same text that was used in the previous sub-
  881.         stitution.
  882.  
  883.         3.7.  Undo Command
  884.  
  885.                 undo
  886.  
  887.  
  888.              The undo command restores the file to the state it  was
  889.         in before your most recent command which changed text.
  890.  
  891.         3.8.  Configuration & Status Commands
  892.  
  893.                 map[!] [key mapped_to]
  894.                 unmap[!] key
  895.                 abbr [word expanded_form_of_word]
  896.                 unabbr word
  897.                 digraph[!] [XX [Y]]
  898.                 set [options]
  899.                 mkexrc
  900.                 [line] mark "x
  901.                 visual
  902.                 version
  903.                 [line][,line] =
  904.                 file [file]
  905.                 source file
  906.                 @ "x
  907.                 color [when] [["light"] color] ["on" color]
  908.  
  909.  
  910.              The map command allows you to configure Elvis to recog-
  911.         nize  your  function  keys,  and  treat  them as though they
  912.         transmitted some other  sequence  of  characters.   Normally
  913.         this  mapping  is done only when in the visual command mode,
  914.         but with the [!] present it will map keys  under  input  and
  915.         replace  modes  as well.  When this command is given with no
  916.         arguments, it prints a table showing all mappings  currently
  917.         in effect.  When called with two arguments, the first is the
  918.         sequence that your function key really sends, and the second
  919.  
  920.  
  921.  
  922.                                March 23, 1992
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         3-6                 COLON MODE COMMANDS                  3-6
  929.  
  930.  
  931.         is  the  sequence  that you want Elvis to treat it as having
  932.         sent.  As a special case, if the first argument is a  number
  933.         then  Elvis  will  map  the  corresponding function key; for
  934.         example, ":map 7 dd" will cause the <F7>  key  to  delete  a
  935.         line.
  936.  
  937.              The unmap command removes  key  definitions  that  were
  938.         made via the map command.
  939.  
  940.              The abbr command is used  to  define/list  a  table  of
  941.         abbreviations.  The table contains both the abbreviated form
  942.         and the fully spelled-out form.  When you're in visual input
  943.         mode,  and  you  type  in  the  abbreviated form, Elvis will
  944.         replace the abbreviated  form  with  the  fully  spelled-out
  945.         form.   When  this  command  is called without arguments, it
  946.         lists the table; with two or more arguments, the first argu-
  947.         ment  is  taken as the abbreviated form, and the rest of the
  948.         command line is the fully-spelled out form.
  949.  
  950.              The unabbr command deletes entries from the abbr table.
  951.  
  952.              The digraph command allows you to display  the  set  of
  953.         digraphs  that  Elvis is using, or add/remove a digraph.  To
  954.         list the set of digraphs, use the digraph  command  with  no
  955.         arguments.   To  add  a digraph, you should give the digraph
  956.         command two arguments.  The first argument is the two  ASCII
  957.         characters  that  are to be combined; the second is the non-
  958.         ASCII  character  that  they   represent.    The   non-ASCII
  959.         character's most significant bit is automatically set by the
  960.         digraph command, unless to append a ! to the  command  name.
  961.         Removal  of a digraph is similar to adding a digraph, except
  962.         that you should leave off the second argument.
  963.  
  964.              The set command  allows  you  examine  or  set  various
  965.         options.   With  no  arguments,  it  displays  the values of
  966.         options that have been changed.  With  the  single  argument
  967.         "all"  it  displays the values of all options, regardless of
  968.         whether they've been explicitly set or not.  Otherwise,  the
  969.         arguments are treated as options to be set.
  970.  
  971.              The mkexrc command saves the current configuration to a
  972.         file called ".exrc" in the current directory.
  973.  
  974.              The mark command defines a named mark  to  refer  to  a
  975.         specific  place in the file.  This mark may be used later to
  976.         specify lines for other commands.
  977.  
  978.              The visual command puts the editor  into  visual  mode.
  979.         Instead of emulating ex, Elvis will start emulating vi.
  980.  
  981.              The version command tells  you  that  what  version  of
  982.         Elvis this is.
  983.  
  984.              The = command tells you what line you specified, or, if
  985.  
  986.  
  987.  
  988.                                March 23, 1992
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         3-7                 COLON MODE COMMANDS                  3-7
  995.  
  996.  
  997.         you  specified  a range of lines, it will tell you both end-
  998.         points and the number of lines included in the range.
  999.  
  1000.              The file command  tells  you  the  name  of  the  file,
  1001.         whether  it  has  been  modified, the number of lines in the
  1002.         file, and the current line number.  You can also use  it  to
  1003.         change the name of the current file.
  1004.  
  1005.              The source command reads a sequence of colon mode  com-
  1006.         mands from a file, and interprets them.
  1007.  
  1008.              The @ command executes the contents of a cut-buffer  as
  1009.         EX commands.
  1010.  
  1011.              The color command only works under MS-DOS,  or  if  you
  1012.         have  an  ANSI-compatible  color terminal.  It allows you to
  1013.         set the foreground and background colors for different types
  1014.         of  text: normal, bold, italic, underlined, standout, pop-up
  1015.         menu, and visible selection.  By  default,  it  changes  the
  1016.         "normal"  colors; to change other colors, the first argument
  1017.         to the :color command should be the first letter of the type
  1018.         of  text  you want.  The syntax for the colors themselves is
  1019.         fairly intuitive.  For example, ":color light cyan on  blue"
  1020.         causes  normal  text to be displayed in light cyan on a blue
  1021.         background, and ":color b bright white" causes bold text  to
  1022.         be  displayed  in  bright  white  on a blue background.  The
  1023.         background color always defaults to the  current  background
  1024.         color  of  normal  text.   Your  first  :color  command must
  1025.         specify both the foreground and background for normal text.
  1026.  
  1027.         3.9.  Multiple File Commands
  1028.  
  1029.                 args [files]
  1030.                 next[!] [files]
  1031.                 Next[!]
  1032.                 previous[!]
  1033.                 rewind[!]
  1034.  
  1035.  
  1036.              When you invoke Elvis from your shell's  command  line,
  1037.         any filenames that you give to Elvis as arguments are stored
  1038.         in the args list.  The args command will display this  list,
  1039.         or define a new one.
  1040.  
  1041.              The next command switches from the current file to  the
  1042.         next  one in the args list.  You may specify a new args list
  1043.         here, too.
  1044.  
  1045.              The Next and previous commands (they're really  aliases
  1046.         for  the  same  command) switch from the current file to the
  1047.         preceding file in the args list.
  1048.  
  1049.              The rewind command switches from the  current  file  to
  1050.         the first file in the args list.
  1051.  
  1052.  
  1053.  
  1054.                                March 23, 1992
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.         3-8                 COLON MODE COMMANDS                  3-8
  1061.  
  1062.  
  1063.         3.10.  Switching Files
  1064.  
  1065.                 edit[!] [file]
  1066.                 tag[!] tagname
  1067.  
  1068.  
  1069.              The edit command allows to switch from the current file
  1070.         to  some  other  file.  This has nothing to do with the args
  1071.         list, by the way.
  1072.  
  1073.              The tag command looks up a  given  tagname  in  a  file
  1074.         called  "tags".  This tells it which file the tag is in, and
  1075.         how to find it in that file.  Elvis  then  switches  to  the
  1076.         tag's file and finds the tag.
  1077.  
  1078.         3.11.  Working with a Compiler
  1079.  
  1080.                 cc [files]
  1081.                 make [target]
  1082.                 errlist[!] [errlist]
  1083.  
  1084.  
  1085.              The cc and  make  commands  execute  your  compiler  or
  1086.         "make"  utility  and redirect any error messages into a file
  1087.         called "errlist".  By default, cc  is  run  on  the  current
  1088.         file.  (You should write it before running cc.) The contents
  1089.         of the "errlist" file are then scanned for  error  messages.
  1090.         If  an  error  message is found, then the cursor is moved to
  1091.         the line where the error was detected, and  the  description
  1092.         of the error is displayed on the status line.
  1093.  
  1094.              After you've fixed one error, the errlist command  will
  1095.         move  the cursor to the next error.  In visual command mode,
  1096.         hitting `*' will do this, too.
  1097.  
  1098.              You can also create an "errlist" file from  outside  of
  1099.         Elvis, and use "Elvis -m" to start elvis and have the cursor
  1100.         moved to the first error.  Note that you don't need to  sup-
  1101.         ply  a  filename  with "Elvis -m" because the error messages
  1102.         always say which source file an error is in.
  1103.  
  1104.              Note: When you use errlist repeatedly  to  fix  several
  1105.         errors  in  a  single  file,  it  will attempt to adjust the
  1106.         reported line numbers to  allow  for  lines  that  you  have
  1107.         inserted  or  deleted.   These adjustments are made with the
  1108.         assumption that you will  work  though  the  file  from  the
  1109.         beginning to the end.
  1110.  
  1111.         3.12.  Exit Commands
  1112.  
  1113.                 quit[!]
  1114.                 wq
  1115.                 xit
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                                March 23, 1992
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.         3-9                 COLON MODE COMMANDS                  3-9
  1127.  
  1128.  
  1129.              The quit command exits from the editor  without  saving
  1130.         your file.
  1131.  
  1132.              The wq command writes your file out, then then exits.
  1133.  
  1134.              The xit command is similar to the  wq  command,  except
  1135.         that  xit  won't  bother  to  write your file if you haven't
  1136.         modified it.
  1137.  
  1138.         3.13.  File I/O Commands
  1139.  
  1140.                 [line] read file
  1141.                 [line][,line] write[!] [[>>]file]
  1142.  
  1143.  
  1144.              The read  command  gets  text  from  another  file  and
  1145.         inserts  it  after the specified line.  It can also read the
  1146.         output of a program; simply precede the program  name  by  a
  1147.         '!' and use it in place of the file name.
  1148.  
  1149.              The write command writes the whole file, or  just  part
  1150.         of  it,  to some other file.  The !, if present, will permit
  1151.         the lines to be written even  if  you've  set  the  readonly
  1152.         option.   If  you  precede the filename by >> then the lines
  1153.         will be appended to the file.  You can send the lines to the
  1154.         standard input of a program by replacing the filename with a
  1155.         '!' followed by the command and its arguments.
  1156.  
  1157.              Note: Be careful not to confuse ":w!filename"  and  ":w
  1158.         !command".   To  write  to a program, you must have at least
  1159.         one blank before the '!'.
  1160.  
  1161.         3.14.  Directory Commands
  1162.  
  1163.                 cd [directory]
  1164.                 chdir [directory]
  1165.                 shell
  1166.  
  1167.  
  1168.              The cd and chdir commands (really  two  names  for  one
  1169.         command) switch the current working directory.
  1170.  
  1171.              The shell command starts an interactive shell.
  1172.  
  1173.         3.15.  Debugging Commands
  1174.  
  1175.                 [line][,line] debug[!]
  1176.                 validate[!]
  1177.  
  1178.  
  1179.              These commands are only available if you compile  Elvis
  1180.         with the -DDEBUG flag.
  1181.  
  1182.              The debug command lists statistics for the blocks which
  1183.  
  1184.  
  1185.  
  1186.                                March 23, 1992
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.         3-10                COLON MODE COMMANDS                 3-10
  1193.  
  1194.  
  1195.         contain  the specified range of lines.  If the ! is present,
  1196.         then the contents of those blocks is displayed, too.
  1197.  
  1198.              The  validate  command  checks  certain  variables  for
  1199.         internal  consistency.   Normally it doesn't output anything
  1200.         unless it detects a problem.  With the !,  though,  it  will
  1201.         always produce *some* output.
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                                March 23, 1992
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.         4.  REGULAR EXPRESSIONS
  1262.  
  1263.  
  1264.              Elvis uses regular expressions for searching  and  sub-
  1265.         stututions.   A regular expression is a text string in which
  1266.         some characters have special meanings.  This  is  much  more
  1267.         powerful than simple text matching.
  1268.  
  1269.         Syntax
  1270.  
  1271.              Elvis' regexp package  treats  the  following  one-  or
  1272.         two-character  strings  (called  meta-characters) in special
  1273.         ways:
  1274.  
  1275.         \(subexpression\)
  1276.                 The \( and \) metacharacters  are  used  to  delimit
  1277.                 subexpressions.  When the regular expression matches
  1278.                 a particular chunk  of  text,  Elvis  will  remember
  1279.                 which  portion  of that chunk matched the subexpres-
  1280.                 sion.  The :s/regexp/newtext/ command makes  use  of
  1281.                 this feature.
  1282.  
  1283.         ^       The ^ metacharacter matches the beginning of a line.
  1284.                 If,  for  example,  you  wanted to find "foo" at the
  1285.                 beginning of a line, you would use a regular expres-
  1286.                 sion  such  as  /^foo/.  Note that ^ is only a meta-
  1287.                 character if it occurs at the beginning of a regular
  1288.                 expression; anyplace else, it is treated as a normal
  1289.                 character.
  1290.  
  1291.         $       The $ metacharacter matches the end of a  line.   It
  1292.                 is only a metacharacter when it occurs at the end of
  1293.                 a regular expression; elsewhere, it is treated as  a
  1294.                 normal  character.  For example, the regular expres-
  1295.                 sion /$$/ will search for a dollar sign at  the  end
  1296.                 of a line.
  1297.  
  1298.         \<      The \< metacharacter matches a zero-length string at
  1299.                 the beginning of a word.  A word is considered to be
  1300.                 a string of 1 or more letters and  digits.   A  word
  1301.                 can  begin  at the beginning of a line or after 1 or
  1302.                 more non-alphanumeric characters.
  1303.  
  1304.         \>      The \> metacharacter matches a zero-length string at
  1305.                 the end of a word.  A word can end at the end of the
  1306.                 line or before 1 or  more  non-alphanumeric  charac-
  1307.                 ters.    For   example,  /\<end\>/  would  find  any
  1308.                 instance of the word "end",  but  would  ignore  any
  1309.                 instances  of  e-n-d  inside  another  word  such as
  1310.                 "calendar".
  1311.  
  1312.         .       The . metacharacter matches any single character.
  1313.  
  1314.         [character-list]
  1315.  
  1316.  
  1317.  
  1318.                                March 23, 1992
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.         4-2                 REGULAR EXPRESSIONS                  4-2
  1325.  
  1326.  
  1327.                 This  matches  any   single   character   from   the
  1328.                 character-list.   Inside the character-list, you can
  1329.                 denote a span of  characters  by  writing  only  the
  1330.                 first  and  last  characters,  with a hyphen between
  1331.                 them.  If the character-list  is  preceded  by  a  ^
  1332.                 character,  then  the  list  is  inverted -- it will
  1333.                 match character that isn't mentioned  in  the  list.
  1334.                 For  example, /[a-zA-Z]/ matches any letter, and /[^
  1335.                 ]/ matches anything other than a blank.
  1336.  
  1337.         \{n\}   This is a closure operator, which means that it  can
  1338.                 only be placed after something that matches a single
  1339.                 character.  It controls the number of times that the
  1340.                 single-character expression should be repeated.
  1341.  
  1342.                 The \{n\} operator, in particular,  means  that  the
  1343.                 preceding  expression  should  be repeated exactly n
  1344.                 times.  For example, /^-\{80\}$/ matches a  line  of
  1345.                 eighty  hyphens, and /\<[a-zA-Z]\{4\}\>/ matches any
  1346.                 four-letter word.
  1347.  
  1348.         \{n,m\} This is a closure  operator  which  means  that  the
  1349.                 preceding   single-character  expression  should  be
  1350.                 repeated between n and m times, inclusive.  If the m
  1351.                 is  omitted  (but  the  comma  is present) then m is
  1352.                 taken to be inifinity.  For example, /"[^"]\{3,5\}"/
  1353.                 matches  any  pair  of  quotes which contains three,
  1354.                 four, or five non-quote characters.
  1355.  
  1356.         *       The * metacharacter  is  a  closure  operator  which
  1357.                 means that the preceding single-character expression
  1358.                 can  be  repeated  zero  or  more  times.    It   is
  1359.                 equivelent  to  \{0,\}.  For example, /.*/ matches a
  1360.                 whole line.
  1361.  
  1362.         \+      The \+ metacharacter is  a  closure  operator  which
  1363.                 means that the preceding single-character expression
  1364.                 can be repeated one or more times.  It is equivelent
  1365.                 to \{1,\}.  For example, /.\+/ matches a whole line,
  1366.                 but only if the line contains at least  one  charac-
  1367.                 ter.  It doesn't match empty lines.
  1368.  
  1369.         \?      The \? metacharacter is  a  closure  operator  which
  1370.                 indicates   that   the   preceding  single-character
  1371.                 expression is optional -- that is, that it can occur
  1372.                 0  or  1  times.   It is equivelent to \{0,1\}.  For
  1373.                 example, /no[ -]\?one/ matches "no  one",  "no-one",
  1374.                 or "noone".
  1375.  
  1376.              Anything else is treated as a  normal  character  which
  1377.         must  exactly  match a character from the scanned text.  The
  1378.         special strings may all be preceded by a backslash to  force
  1379.         them to be treated normally.
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                                March 23, 1992
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.         4-3                 REGULAR EXPRESSIONS                  4-3
  1391.  
  1392.  
  1393.         Substitutions
  1394.  
  1395.              The :s command has at least two  arguments:  a  regular
  1396.         expression,  and  a  substitution  string.   The  text  that
  1397.         matched the regular expression is replaced by text which  is
  1398.         derived from the substitution string.
  1399.  
  1400.              Most characters in the substitution string  are  copied
  1401.         into the text literally but a few have special meaning:
  1402.  
  1403.                &     Insert a copy of the original text
  1404.                ~     Insert a copy of the previous replacement text
  1405.                \1    Insert a copy of that portion of the original text which
  1406.                      matched the first set of \( \) parentheses
  1407.                \2-\9 Do the same for the second (etc.) pair of \( \)
  1408.                \U    Convert all chars of any later & or \# to uppercase
  1409.                \L    Convert all chars of any later & or \# to lowercase
  1410.                \E    End the effect of \U or \L
  1411.                \u    Convert the first char of the next & or \# to uppercase
  1412.                \l    Convert the first char of the next & or \# to lowercase
  1413.  
  1414.  
  1415.              These may be preceded by a backslash to force  them  to
  1416.         be treated normally.  If "nomagic" mode is in effect, then &
  1417.         and ~ will be treated normally, and you must write  them  as
  1418.         \& and \~ for them to have special meaning.
  1419.  
  1420.         Options
  1421.  
  1422.              Elvis has two options  which  affect  the  way  regular
  1423.         expressions  are used.  These options may be examined or set
  1424.         via the :set command.
  1425.  
  1426.              The first option is  called  "[no]magic".   This  is  a
  1427.         boolean  option, and it is "magic" (TRUE) by default.  While
  1428.         in  magic  mode,  all  of  the  meta-characters  behave   as
  1429.         described above.  In nomagic mode, only ^ and $ retain their
  1430.         special meaning.
  1431.  
  1432.              The second option is called "[no]ignorecase".  This  is
  1433.         a  boolean  option,  and  it  is  "noignorecase"  (FALSE) by
  1434.         default.  While in ignorecase mode, the searching  mechanism
  1435.         will  not  distinguish  between  an uppercase letter and its
  1436.         lowercase form.  In noignorecase mode, uppercase and  lower-
  1437.         case are treated as being different.
  1438.  
  1439.              Also, the "[no]wrapscan" option affects searches.
  1440.  
  1441.         Examples
  1442.  
  1443.              This example changes every occurence  of  "utilize"  to
  1444.         "use":
  1445.  
  1446.                   :%s/utilize/use/g
  1447.  
  1448.  
  1449.  
  1450.                                March 23, 1992
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.         4-4                 REGULAR EXPRESSIONS                  4-4
  1457.  
  1458.  
  1459.              This example deletes all whitespace that occurs at  the
  1460.         end of a line anywhere in the file.  (The brackets contain a
  1461.         single space and a single tab.):
  1462.  
  1463.                   :%s/[   ]\+$//
  1464.  
  1465.              This example converts the current line to uppercase:
  1466.  
  1467.                   :s/.*/\U&/
  1468.  
  1469.              This example underlines  each  letter  in  the  current
  1470.         line,  by  changing it into an "underscore backspace letter"
  1471.         sequence.  (The ^H is entered as "control-V backspace".):
  1472.  
  1473.                   :s/[a-zA-Z]/_^H&/g
  1474.  
  1475.              This example locates the last  colon  in  a  line,  and
  1476.         swaps  the  text  before  the  colon with the text after the
  1477.         colon.  The first \( \) pair is used to  delimit  the  stuff
  1478.         before  the  colon,  and  the  second pair delimit the stuff
  1479.         after.  In the substitution text, \1 and  \2  are  given  in
  1480.         reverse order to perform the swap:
  1481.  
  1482.                   :s/\(.*\):\(.*\)/\2:\1/
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                                March 23, 1992
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.         5.  OPTIONS
  1526.  
  1527.              Options may be set or examined via  the  colon  command
  1528.         "set".   The  values of options will affect the operation of
  1529.         later commands.
  1530.  
  1531.              For convenience, options have both a  long  descriptive
  1532.         name  and  a  short name which is easy to type.  You may use
  1533.         either name interchangably.  I like the short names, myself.
  1534.  
  1535.              There are three types of options: Boolean, string,  and
  1536.         numeric.   Boolean  options are made TRUE by giving the name
  1537.         of the option as an argument to the "set" command; they  are
  1538.         made  FALSE  by  prefixing the name with "no".  For example,
  1539.         "set autoindent" makes the autoindent option TRUE, and  "set
  1540.         noautoindent"  makes  it  FALSE.   Elvis also allows boolean
  1541.         options to be toggled by prefixing the name with "neg".  So,
  1542.         ":map  g  :set  neglist^M"  will cause the <g> key to alter-
  1543.         nately toggle the "list" option on and off.  (The "neg" pre-
  1544.         fix is an extension; the real vi doesn't support it.)
  1545.  
  1546.              To change the value of a string or numeric option, pass
  1547.         the "set" command the name of the option, followed by an "="
  1548.         sign  and  the  option's  new  value.   For  example,   "set
  1549.         tabstop=8"  will  give the tabstop option a value of 8.  For
  1550.         string options, you may enclose the new value in quotes.
  1551.  
  1552.         NAMES              TYPE DEFAULT       MEANING
  1553.         autoindent, ai     Bool noai          auto-indent during input
  1554.         autoprint, ap      Bool ap            in EX, print the current line
  1555.         autotab, at        Bool at            auto-indent allowed to use tabs?
  1556.         autowrite, aw      Bool noaw          auto-write when switching files
  1557.         beautify,  bf      Bool nobf          strip control chars from file?
  1558.         charattr, ca       Bool noca          interpret \fX sequences?
  1559.         cc, cc             Str  cc="cc -c"    name of the C compiler
  1560.         columns, co        Num  co=80         width of the screen
  1561.         digraph, dig       Bool nodig         recognize digraphs?
  1562.         directory, dir     Str  dir="/usr/tmp"where tmp files are kept
  1563.         edcompatible, ed   Bool noed          remember ":s//" options
  1564.         equalprg, ep       Bool ep="fmt"      program to run for = operator
  1565.         errorbells, eb     Bool eb            ring bell on error
  1566.         exrc, exrc         Bool noexrc        read "./.exrc" file?
  1567.         exrefresh, er      Bool er            write lines indiviually in EX
  1568.         flash, vbell       Bool flash         use visible alternative to bell
  1569.         flipcase, fc       Str  fc=""         non-ASCII chars flipped by ~
  1570.         hideformat, hf     Bool hf            hide text formatter commands
  1571.         ignorecase, ic     Bool noic          upper/lowercase match in search
  1572.         inputmode, im      Bool noim          start vi in insert mode?
  1573.         keytime, kt        Num  kt=2          timeout for mapped key entry
  1574.         keywordprg, kp     Str  kp="ref"      full pathname of shift-K prog
  1575.         lines, ln          Num  ln=25         number of lines on the screen
  1576.         list, li           Bool noli          display lines in "list" mode
  1577.         magic, ma          Bool ma            use regular expression in search
  1578.         make, mk           Str  mk="make"     name of the "make" program
  1579.  
  1580.  
  1581.  
  1582.                                March 23, 1992
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.         5-2                       OPTIONS                        5-2
  1589.  
  1590.  
  1591.         mesg, ms           Bool ms            allow messages from other users?
  1592.         modelines, ml      Bool noml          are modelines processed?
  1593.         more, more         Bool more          pause between messages?
  1594.         novice, nov        Bool nonovice      set options for ease of use
  1595.         paragraphs, para   Str  para="PPppIPLPQP"names of "paragraph" nroff cmd
  1596.         prompt, pr         Bool pr            show ':' prompt in ex mode
  1597.         readonly, ro       Bool noro          prevent overwriting of orig file
  1598.         remap, rem         Bool remap         allow key maps to call key maps
  1599.         report, re         Num  re=5          report when 5 or more changes
  1600.         ruler, ru          Bool noru          display line/column numbers
  1601.         scroll, sc         Num  sc=12         scroll amount for ^U and ^D
  1602.         sections, sect     Str  sect="NHSHSSSEse"names of "section" nroff cmd
  1603.         shell, sh          Str  sh="/bin/sh"  full pathname of the shell
  1604.         showmatch, sm      Bool nosm          show matching ()[]{}
  1605.         showmode, smd      Bool nosmd         say when we're in input mode
  1606.         shiftwidth, sw     Num  sw=8          shift amount for < and >
  1607.         sidescroll, ss     Num  ss=8          amount of sideways scrolling
  1608.         sync, sy           Bool nosy          call sync() often
  1609.         tabstop, ts        Num  ts=8          width of tab characters
  1610.         taglength, tl      Num  tl=0          significant chars in tag name
  1611.         term, te           Str  te="$TERM"    name of the termcap entry
  1612.         terse, tr          Bool notr          give shorter error messages
  1613.         timeout, to        Bool to            distinguish <esc> from <arrow>?
  1614.         warn, wa           Bool wa            warn for ! if file modified
  1615.         window, wi         Num  wi=24         lines to redraw after long move
  1616.         wrapmargin, wm     Num  wm=0          wrap long lines in input mode
  1617.         wrapscan, ws       Bool ws            at EOF, searches wrap to line 1
  1618.         writeany, wr       Bool nowr          allow :w to clobber files
  1619.  
  1620.  
  1621.         autoindent, ai
  1622.              During input mode, the  autoindent  option  will  cause
  1623.              each  added line to begin with the same amount of lead-
  1624.              ing whitespace as the line above it.   Without  autoin-
  1625.              dent, added lines are initially empty.
  1626.  
  1627.         autoprint, ap
  1628.              This option only affects EX  mode.   If  the  autoprint
  1629.              option  on,  and  either the cursor has moved to a dif-
  1630.              ferent line or the previous command modified the  file,
  1631.              then Elvis will print the current line.
  1632.  
  1633.         autotab, at
  1634.              This option affects the  behaviour  of  the  autoindent
  1635.              mode.  If autoindent is turned off, then autotab has no
  1636.              effect.
  1637.  
  1638.              When autotab is turned on, elvis will use a mixture  of
  1639.              spaces and tabs to create the proper amount of indenta-
  1640.              tion.  This is the default.
  1641.  
  1642.              When autotab is turned off, elvis will only use  spaces
  1643.              for  auto-indent.   Elvis  will still insert a real tab
  1644.              character when you  hit  the  <Tab>  key,  though;  the
  1645.  
  1646.  
  1647.  
  1648.                                March 23, 1992
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.         5-3                       OPTIONS                        5-3
  1655.  
  1656.  
  1657.              autotab option only affects automatic indentation.
  1658.  
  1659.         autowrite, aw
  1660.              When you're editing one file and decide  to  switch  to
  1661.              another  -  via  the  :tag  command,  or :next command,
  1662.              perhaps - if your current file has been modified,  then
  1663.              Elvis  will  normally print an error message and refuse
  1664.              to switch.
  1665.  
  1666.              However, if the autowrite option is on, then Elvis will
  1667.              write the modified version of the current file and suc-
  1668.              cessfully switch to the new file.
  1669.  
  1670.         beautify, bf
  1671.              This option causes all control characters to be deleted
  1672.              from  the text file, at the time when you start editing
  1673.              it.  If you're already editing a file when you turn  on
  1674.              the beautify option, then that file won't be affected.
  1675.  
  1676.         cc   The :cc command  runs  the  C  compiler.   This  option
  1677.              should be set to the name of your compiler.
  1678.  
  1679.         charattr, ca
  1680.              Many text formatting programs allow  you  to  designate
  1681.              portions  of your text to be underlined, italicized, or
  1682.              boldface by embedding the special strings \fU, \fI, and
  1683.              \fB in your text.  The special string \fP marks the end
  1684.              of underlined or boldface text.
  1685.  
  1686.              Elvis normally treats those special strings  just  like
  1687.              any other text.
  1688.  
  1689.              However, if the charattr option is on, then Elvis  will
  1690.              interpret  those  special strings correctly, to display
  1691.              underlined or boldface text on the screen.  (This  only
  1692.              works,  of  course, if your terminal can display under-
  1693.              lined and boldface, and if the TERMCAP entry  says  how
  1694.              to do it.)
  1695.  
  1696.         columns, co
  1697.              This option shows how wide your screen is.
  1698.  
  1699.         digraph, dig
  1700.              This option is used to  enable/disable  recognition  of
  1701.              digraphs.   The default value is nodigraph, which means
  1702.              that digraphs will not be recognized.
  1703.  
  1704.         directory, dir
  1705.              Elvis stores text  in  temporary  files.   This  option
  1706.              allows  you  to control which directory those temporary
  1707.              files will appear in.  The default is /usr/tmp.
  1708.  
  1709.              This option can only be set  in  a  .exrc  file;  after
  1710.              that,  Elvis will have already started making temporary
  1711.  
  1712.  
  1713.  
  1714.                                March 23, 1992
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.         5-4                       OPTIONS                        5-4
  1721.  
  1722.  
  1723.              files in some other directory, so it would be too late.
  1724.  
  1725.         edcompatible, ed
  1726.              This   option   affects   the    behaviour    of    the
  1727.              ":s/regexp/text/options"  command.   It is normally off
  1728.              (:se noed) which causes all of the substitution options
  1729.              to be off unless explicitly given.
  1730.  
  1731.              However, with edcompatible on (:se ed),  the  substitu-
  1732.              tion  command  remembers  which  options  you used last
  1733.              time.  Those same options  will  continue  to  be  used
  1734.              until  you change them.  In edcompatible mode, when you
  1735.              explicitly give the name of a substitution option,  you
  1736.              will toggle the state of that option.
  1737.  
  1738.              This all seems very strange to me, but its  implementa-
  1739.              tion  was  almost free when I added the ":&" command to
  1740.              repeat the previous substitution, so there it is.
  1741.  
  1742.         equalprg, ep
  1743.              This holds the name & arguments of the external  filter
  1744.              program  used  the  the visual = operator.  The defualt
  1745.              value is "fmt", so the  =  operator  will  adjust  line
  1746.              breaks in text.
  1747.  
  1748.         errorbells, eb
  1749.              Elvis normally rings  a  bell  when  you  do  something
  1750.              wrong.  This option lets you disable the bell.
  1751.  
  1752.         exrc This option specifies  whether  a  .exrc  file  in  the
  1753.              current directory should be executed.  By default, this
  1754.              option is off (":set noexrc") which prevents elvis from
  1755.              executing .exrc in the current directory.  If the .exrc
  1756.              file in your home directory turns this option on (":set
  1757.              exrc") then the Elvis will attempt to execute the .exrc
  1758.              file in the current directory.
  1759.  
  1760.              This option  exist  mainly  for  security  reasons.   A
  1761.              mean-spirited person could do something like
  1762.                   echo >/tmp/.exrc '!rm -rf $HOME'
  1763.              and then anybody who attempted to edit or view  a  file
  1764.              in  the  /tmp directory would lose most of their files.
  1765.              With the exrc option turned off, this  couldn't  happen
  1766.              to you.
  1767.  
  1768.         exrefresh, er
  1769.              The EX mode of Elvis writes many lines to  the  screen.
  1770.              You can make Elvis either write each line to the screen
  1771.              separately, or save up many lines and write them all at
  1772.              once.
  1773.  
  1774.              The exrefresh option is normally on, so  each  line  is
  1775.              written to the screen separately.
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                                March 23, 1992
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.         5-5                       OPTIONS                        5-5
  1787.  
  1788.  
  1789.              You may wish to turn  the  exrefresh  option  off  (:se
  1790.              noer)  if  the  "write"  system  call is costly on your
  1791.              machine, or if you're using  a  windowing  environment.
  1792.              (Windowing  environments  scroll text a lot faster when
  1793.              you write many lines at once.)
  1794.  
  1795.              This option has no effect in  visual  command  mode  or
  1796.              input mode.
  1797.  
  1798.         flash, vbell
  1799.              If your termcap entry describes a  visible  alternative
  1800.              to  ringing your terminal's bell, then this option will
  1801.              say whether the visible version gets used or not.  Nor-
  1802.              mally it will be.
  1803.  
  1804.              If your termcap does NOT include a visible  bell  capa-
  1805.              bility,  then  the  flash  option  will be off, and you
  1806.              can't turn it on.
  1807.  
  1808.         flipcase, fc
  1809.              The flipcase option allows you to control how the  non-
  1810.              ASCII characters are altered by the "~" command.
  1811.  
  1812.              The string is divided into pairs of  characters.   When
  1813.              "~" is applied to a non-ASCII character, Elvis looks up
  1814.              the character in the flipcase string to see which  pair
  1815.              it's  in, and replaces it by the other character of the
  1816.              pair.
  1817.  
  1818.         hideformat, hf
  1819.              Many text formatters require you to embed  format  com-
  1820.              mands  in  your  text,  on  lines that start with a "."
  1821.              character.  Elvis normally displays  these  lines  like
  1822.              any  other  text,  but  if the hideformat option is on,
  1823.              then format lines are displayed as blank lines.
  1824.  
  1825.         ignorecase, ic
  1826.              Normally, when  Elvis  searches  for  text,  it  treats
  1827.              uppercase  letters  as  being  different  for lowercase
  1828.              letters.
  1829.  
  1830.              When the ignorecase option is on, uppercase and  lower-
  1831.              case are treated as equal.
  1832.  
  1833.         inputmode, im
  1834.              This option allows you to have Elvis start up in insert
  1835.              mode.   You  can  still exit insert mode at any time by
  1836.              hitting the ESC key, as usual.   Usually,  this  option
  1837.              would be set in your ".exrc" file.
  1838.  
  1839.         keytime, kt
  1840.              The arrow keys of most terminals send a multi-character
  1841.              sequence.   It  takes  a  measurable amount of time for
  1842.              these sequences to be transmitted.  The keytime  option
  1843.  
  1844.  
  1845.  
  1846.                                March 23, 1992
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.         5-6                       OPTIONS                        5-6
  1853.  
  1854.  
  1855.              allows  you  to  control  the maximum amount of time to
  1856.              allow for an arrow key (or  other  mapped  key)  to  be
  1857.              received in full.
  1858.  
  1859.              On most systems, the setting is the number of tenths of
  1860.              a  second  to  allow between characters.  On some other
  1861.              systems, the setting is in whole seconds.
  1862.  
  1863.              Try to avoid  setting  keytime=1.   Most  systems  just
  1864.              count  clock beats, so if you tried to read a character
  1865.              shortly before a clock beat, you could allow almost  no
  1866.              time  at  all  for  reading the characters.  For higher
  1867.              keytime settings, the difference is less critical.
  1868.  
  1869.              If your system's response time is poor, you might  want
  1870.              to  increase  the  keytime.   In particular, I've found
  1871.              that when keystrokes must be  sent  through  a  network
  1872.              (via  X  windows,  rlogin,  or telnet, for example) the
  1873.              keytime should be set to at least 1 second.
  1874.  
  1875.              As a special case, you can set keytime to 0 to  disable
  1876.              this time limit stuff altogether.  The big problem here
  1877.              is: If your arrow keys' sequences start  with  an  ESC,
  1878.              then every time you hit your ESC key Elvis will wait...
  1879.              and wait...  to see if maybe that ESC was  part  of  an
  1880.              arrow key's sequence.
  1881.  
  1882.              NOTE: this option is a generalization  of  the  timeout
  1883.              option of the real vi.
  1884.  
  1885.         keywordprg, kp
  1886.              Elvis has a special keyword lookup feature.   You  move
  1887.              the cursor onto a word, and hit shift-K, and Elvis uses
  1888.              another program to look up the word and display  infor-
  1889.              mation about it.
  1890.  
  1891.              This option says which program gets run.
  1892.  
  1893.              The default value of this option is "ref", which  is  a
  1894.              program  that  looks up the definition of a function in
  1895.              C.  It looks up the function  name  in  a  file  called
  1896.              "refs" which is created by ctags.
  1897.  
  1898.              You can subtitute other programs, such  as  an  English
  1899.              dictionary  program  or  the online manual.  Elvis runs
  1900.              the program, using the keyword as  its  only  argument.
  1901.              The  program  should  write information to stdout.  The
  1902.              program's exit status should  be  0,  unless  you  want
  1903.              Elvis to print "<<< failed >>>".
  1904.  
  1905.         lines, ln
  1906.              This option says how many lines you screen has.
  1907.  
  1908.         list, li
  1909.  
  1910.  
  1911.  
  1912.                                March 23, 1992
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.         5-7                       OPTIONS                        5-7
  1919.  
  1920.  
  1921.              In nolist mode (the default), Elvis displays text in  a
  1922.              "normal" manner -- with tabs expanded to an appropriate
  1923.              number of spaces, etc.
  1924.  
  1925.              However, sometimes it is useful to have tab  characters
  1926.              displayed   differently.    In   list  mode,  tabs  are
  1927.              displayed as "^I", and a "$" is displayed at the end of
  1928.              each line.
  1929.  
  1930.         magic, ma
  1931.              The search  mechanism  in  Elvis  can  accept  "regular
  1932.              expressions"  --  strings  in  which certain characters
  1933.              have special meaning.
  1934.  
  1935.              The magic option is normally  on,  which  causes  these
  1936.              characters to be treated specially.
  1937.  
  1938.              If you turn the magic option off (:se noma),  then  all
  1939.              characters except ^ and $ are treated literally.  ^ and
  1940.              $ retain their special meanings regardless of the  set-
  1941.              ting of magic.
  1942.  
  1943.         make, mk
  1944.              The :make  command  runs  your  "make"  program.   This
  1945.              option defines the name of your "make" program.
  1946.  
  1947.         mesg With the  real  vi,  running  under  real  UNIX,  ":set
  1948.              nomesg" would prevent other users from sending you mes-
  1949.              sages.  Elvis ignores it, though.
  1950.  
  1951.         modelines, ml
  1952.              Elvis supports modelines.  Modelines are lines near the
  1953.              beginning  or  end  of  your  text  file  which contain
  1954.              "ex:yowza:", where "yowza" is any EX command.  A  typi-
  1955.              cal  "yowza"  would  be  something  like  "set  ts=5 ca
  1956.              kp=spell wm=15".  Other text may also appear on a mode-
  1957.              line, so you can place the "ex:yowza:" in a comment:
  1958.  
  1959.                      /* ex:set sw=4 ai: */
  1960.  
  1961.  
  1962.              Normally these lines are ignored, for security reasons,
  1963.              but if you have "set modelines" in your .exrc file then
  1964.              "yowza" is executed.
  1965.  
  1966.         novice, nov
  1967.              The  command  ":set  novice"  is  equivelent  to  ":set
  1968.              nomagic report=1 showmode".
  1969.  
  1970.         paragraphs, pa
  1971.              The { and } commands move the cursor forward  or  back-
  1972.              ward in increments of one paragraph.  Paragraphs may be
  1973.              separated by blank lines, or by a "dot"  command  of  a
  1974.              text   formatter.    Different   text   formatters  use
  1975.  
  1976.  
  1977.  
  1978.                                March 23, 1992
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.         5-8                       OPTIONS                        5-8
  1985.  
  1986.  
  1987.              different "dot" commands.  This option  allows  you  to
  1988.              configure Elvis to work with your text formatter.
  1989.  
  1990.              It is assumed that your formatter  uses  commands  that
  1991.              start  with a "." character at the front of a line, and
  1992.              then have a one- or two-character command name.
  1993.  
  1994.              The value of the paragraphs option is a string in which
  1995.              each  pair  of  characters is one possible form of your
  1996.              text formatter's paragraph command.
  1997.  
  1998.         more When Elvis must display a sequence of messages  at  the
  1999.              bottom  line  of the screen in visual mode, it normally
  2000.              pauses after all but the last one, so you have time  to
  2001.              read them all.
  2002.  
  2003.              If you turn off the "more" option, then Elvis will  not
  2004.              pause.   This means you can only read the last message,
  2005.              but it is usually the most important one anyway.
  2006.  
  2007.         prompt, pr
  2008.              If you ":set noprompt", then Elvis will no longer  emit
  2009.              a  ':'  when  it  expects you to type in an ex command.
  2010.              This is slightly useful if you're  using  an  astonish-
  2011.              ingly  slow  UNIX  machine, but the rest of us can just
  2012.              ignore this one.
  2013.  
  2014.         readonly, ro
  2015.              Normally, Elvis will let you write  back  any  file  to
  2016.              which  you  have  write  permission.  If you don't have
  2017.              write permission, then you can only write  the  changed
  2018.              version of the file to a different file.
  2019.  
  2020.              If you set the readonly option, then Elvis will pretend
  2021.              you  don't  have write permission to any file you edit.
  2022.              It is useful when you really only mean to use Elvis  to
  2023.              look  at  a file, not to change it.  This way you can't
  2024.              change it accidentally.
  2025.  
  2026.              This option is normally off, unless you use the  "view"
  2027.              alias  of  Elvis.   "View" is like "vi" except that the
  2028.              readonly option is on.
  2029.  
  2030.         remap
  2031.              The ":map"  command  allows  you  to  convert  one  key
  2032.              sequence  into another.  The remap option allows you to
  2033.              specify what should happen if portions  of  that  other
  2034.              sequence  are  also  in the map table.  If remap is on,
  2035.              then those portions will also be  mapped,  just  as  if
  2036.              they  had been typed on the keyboard.  If remap is off,
  2037.              then the matching portions will not be mapped.
  2038.  
  2039.              For example, if you enter the commands ":map A  B"  and
  2040.              ":map  B C", then when remap is on, A will be converted
  2041.  
  2042.  
  2043.  
  2044.                                March 23, 1992
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.         5-9                       OPTIONS                        5-9
  2051.  
  2052.  
  2053.              to C.  But when remap is off, A will be converted  only
  2054.              to B.
  2055.  
  2056.         report, re
  2057.              Commands in Elvis may affect many lines.  For  commands
  2058.              that affect a lot of lines, Elvis will output a message
  2059.              saying what was done and how many lines were  affected.
  2060.              This  option allows you to define what "a lot of lines"
  2061.              means.  The default is 5, so any command which  affects
  2062.              5 or more lines will cause a message to be shown.
  2063.  
  2064.         ruler, ru
  2065.              This option is normally off.  If you turn it  on,  then
  2066.              Elvis  will  constantly display the line/column numbers
  2067.              of the cursor, at the bottom of the screen.
  2068.  
  2069.         scroll, sc
  2070.              The ^U and ^D keys normally scroll backward or  forward
  2071.              by half a screenful, but this is adjustable.  The value
  2072.              of this option says how many lines  those  keys  should
  2073.              scroll  by.   If you invoke ^U or ^D with a count argu-
  2074.              ment (for example, "33^D") then this option's value  is
  2075.              set to the count.
  2076.  
  2077.         sections, se
  2078.              The [[ and ]] commands move the cursor backward or for-
  2079.              ward  in increments of 1 section.  Sections may be del-
  2080.              imited by a { character in column 1  (which  is  useful
  2081.              for  C  source  code) or by means of a text formatter's
  2082.              "dot" commands.
  2083.  
  2084.              This option allows you to configure Elvis to work  with
  2085.              your text formatter's "section" command, in exectly the
  2086.              same way that the paragraphs option makes it work  with
  2087.              the formatter's "paragraphs" command.
  2088.  
  2089.         shell, sh
  2090.              When Elvis forks a shell (perhaps for the :! or  :shell
  2091.              commands)  this is the program that is uses as a shell.
  2092.              This is "/bin/sh" by default, unless you have  set  the
  2093.              SHELL (or COMSPEC, for MS-DOS) environment variable, it
  2094.              which  case  the  default  value  is  copied  from  the
  2095.              environment.
  2096.  
  2097.         shiftwidth, sw
  2098.              The < and > commands shift text left or right  by  some
  2099.              uniform  number  of  columns.   The  shiftwidth  option
  2100.              defines that "uniform number".  The default is 8.
  2101.  
  2102.         showmatch, sm
  2103.              With showmatch set, in input mode every  time  you  hit
  2104.              one  of  )}], Elvis will momentarily move the cursor to
  2105.              the matching ({[.
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                                March 23, 1992
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.         5-10                      OPTIONS                       5-10
  2117.  
  2118.  
  2119.         showmode, smd
  2120.              In visual mode, it is easy to forget whether you're  in
  2121.              the  visual  command  mode or input/replace mode.  Nor-
  2122.              mally, the showmode option is off, and  you  haven't  a
  2123.              clue  as  to  which  mode  you're  in.  If you turn the
  2124.              showmode option  on,  though,  a  little  message  will
  2125.              appear  in  the lower right-hand corner of your screen,
  2126.              telling you which mode you're in.
  2127.  
  2128.         sidescroll, ss
  2129.              For long lines, Elvis scrolls sideways.  (This is  dif-
  2130.              ferent from the real vi, which wraps a single long line
  2131.              onto several rows of the screen.)
  2132.  
  2133.              To minimize the number of scrolls needed,  Elvis  moves
  2134.              the  screen  sideways  by several characters at a time.
  2135.              The value of this  option  says  how  many  characters'
  2136.              widths to scroll at a time.
  2137.  
  2138.              Generally, the faster your screen can be  redrawn,  the
  2139.              lower the value you will want in this option.
  2140.  
  2141.         sync, sy
  2142.              If the system crashes during an edit session, then most
  2143.              of  your  work can be recovered from the temporary file
  2144.              that Elvis uses to store changes.   However,  sometimes
  2145.              the  OS  will not copy changes to the hard disk immedi-
  2146.              ately, so recovery might not be possible.  The [no]sync
  2147.              option lets you control this.
  2148.  
  2149.              In nosync mode (which is the default, for UNIX),  Elvis
  2150.              lets  the operating system control when data is written
  2151.              to the disk.  This is generally faster.
  2152.  
  2153.              In sync mode (which is the default for  MS-DOS,  Amiga-
  2154.              Dos,  and  Atari  TOS), Elvis forces all changes out to
  2155.              disk every time you make a change.  This  is  generally
  2156.              safer,  but slower.  It can also be a rather rude thing
  2157.              to do on a multi-user system.
  2158.  
  2159.         tabstop, ts
  2160.              Tab characters are normally 8 characters wide, but  you
  2161.              can change their widths by means of this option.
  2162.  
  2163.         taglength, tl
  2164.              This option allows you to specify how  many  characters
  2165.              of  a tag's name must match when performing tag lookup.
  2166.              As a special case, ":set taglength=0"  means  that  all
  2167.              characters of a tag's name must match.
  2168.  
  2169.              Note: some configurations of Elvis don't  support  this
  2170.              option.
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.                                March 23, 1992
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.         5-11                      OPTIONS                       5-11
  2183.  
  2184.         term, te
  2185.              This read-only option shows the  name  of  the  termcap
  2186.              entry that Elvis is using for your terminal.
  2187.  
  2188.         terse, tr
  2189.              The real vi uses  this  option  to  select  longer  vs.
  2190.              shorter  error  messages.   Elvis  has  only one set of
  2191.              error messages, though, so this option has no effect.
  2192.  
  2193.         timeout, to
  2194.              The command ":set notimeout"  is  equivelent  to  ":set
  2195.              keytime=0",  and  ":set timeout" is equivelent to ":set
  2196.              keytime=1".  This affects the behaviour  of  the  <Esc>
  2197.              key.   See  the  discussion of the "keytime" option for
  2198.              more information.
  2199.  
  2200.         warn, wa
  2201.              If you have modified a file but not yet written it back
  2202.              to  disk,  then  Elvis  will  normally  print a warning
  2203.              before executing a ":!cmd" command.  However, in nowarn
  2204.              mode, this warning is not given.
  2205.  
  2206.              Elvis also normally prints a message after a successful
  2207.              search  that  wrapped  at EOF.  The [no]warn option can
  2208.              also disable this warning.
  2209.  
  2210.         window, wi
  2211.              This option controls how many lines are redrawn after a
  2212.              long move.
  2213.  
  2214.              On fast terminals, this is usually set to the number of
  2215.              rows  that  the  terminal can display, minus one.  This
  2216.              causes the entire screen to be filled with text  around
  2217.              the cursor.
  2218.  
  2219.              On slow terminals, you may wish to reduce this value to
  2220.              about  7  or  so.   That way, if you're doing something
  2221.              like  repeatedly  hitting  'n'  to  search   for   each
  2222.              occurrence of some string and trying to find a particu-
  2223.              lar occurrence, then you don't need to wait as long for
  2224.              Elvis to redraw the screen after each search.
  2225.  
  2226.         wrapmargin, wm
  2227.              Normally (with wrapmargin=0) Elvis will let you type in
  2228.              extremely long lines, if you wish.
  2229.  
  2230.              However, with warpmargin set to something other that  0
  2231.              (wrapmargin=10 is nice), Elvis will automatically cause
  2232.              long lines to be "wrapped" on a word  break  for  lines
  2233.              come  too close to the right-hand margin.  For example:
  2234.              On an 80-column screen, ":set wm=10" will  cause  lines
  2235.              to wrap when their length exceeds 70 columns.
  2236.  
  2237.         wrapscan, ws
  2238.              Normally, when you search  for  something,  Elvis  will
  2239.  
  2240.  
  2241.  
  2242.                                March 23, 1992
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.         5-12                      OPTIONS                       5-12
  2249.  
  2250.  
  2251.              find  it  no  matter  where  it  is in the file.  Elvis
  2252.              starts at the cursor position,  and  searches  forward.
  2253.              If  Elvis  hits EOF without finding what you're looking
  2254.              for, then it wraps around to  continue  searching  from
  2255.              line  1.   If  you  turn  off  the wrapscan option (:se
  2256.              nows), then when Elvis hits EOF  during  a  search,  it
  2257.              will stop and say so.
  2258.  
  2259.         writeany, wr
  2260.              With "writeany" turned off, elvis will prevent you from
  2261.              accidentally overwriting a file.  For example, if "foo"
  2262.              exists then ":w foo" will fail.  If  you  turn  on  the
  2263.              "writeany" option, then ":w foo" will work.
  2264.  
  2265.              Regardless of the setting of "writeany",  though,  ":w!
  2266.              foo"  will  work.   The  '!' forces the ":w" command to
  2267.              write the file unless the operating system won't  allow
  2268.              it.
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.                                March 23, 1992
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.         6.  CUT BUFFERS
  2318.  
  2319.              When Elvis deletes text, it stores that text in  a  cut
  2320.         buffer.   This  happens  in  both  visual  mode and EX mode.
  2321.         There is no practical limit to how much text  a  cut  buffer
  2322.         can hold.
  2323.  
  2324.              There are 36 cut buffers: 26 named buffers ("a  through
  2325.         "z),  9  anonymous  buffers ("1 through "9), and 1 extra cut
  2326.         buffer (".).
  2327.  
  2328.              In EX mode, the :move and  :copy  commands  use  a  cut
  2329.         buffer to temporarily hold the text to be moved/copied.
  2330.  
  2331.         6.1.  Putting text into a Cut Buffer
  2332.  
  2333.              In visual mode, text is copied into a cut  buffer  when
  2334.         you  use the d, y, c, C, s, or x commands.  There are also a
  2335.         few others.
  2336.  
  2337.              By default, the text goes into the "1 buffer.  The text
  2338.         that  used to be in "1 gets shifted into "2, "2 gets shifted
  2339.         into "3, and so on.  The text that used to be in "9 is lost.
  2340.         This  way,  the last 9 things you deleted are still accessi-
  2341.         ble.
  2342.  
  2343.              You can also put the text into a  named  buffer  --  "a
  2344.         through  "z.   To do this, you should type the buffer's name
  2345.         (two keystrokes: a  double-quote  and  a  lowercase  letter)
  2346.         before  the  command  that  will  cut the text.  When you do
  2347.         this, "1 through "9 are not affected by the cut.
  2348.  
  2349.              You can append text to one of the named buffers.  To do
  2350.         this,  type  the  buffer's name in uppercase (a double-quote
  2351.         and an uppercase letter) before the d/y/c/C/s/x command.
  2352.  
  2353.              The ". buffer is special.  It  isn't  affected  by  the
  2354.         d/y/c/C/s/x  command.   Instead, it stores the text that you
  2355.         typed in the last time you were in input mode.  It  is  used
  2356.         to implement the . visual command, and ^A in input mode.
  2357.  
  2358.              In EX mode (also known as  colon  mode),  the  :delete,
  2359.         :change, and :yank commands all copy text into a cut buffer.
  2360.         Like the visual commands, these EX commands normally use the
  2361.         "1  buffer, but you can use one of the named buffers by giv-
  2362.         ing its name after the command.  For example,
  2363.  
  2364.              :20,30y a
  2365.  
  2366.  
  2367.         will copy lines 20 through 30 into cut buffer "a.
  2368.  
  2369.              You can't directly put text into the ". buffer, or  the
  2370.         "2 through "9 buffers.
  2371.  
  2372.  
  2373.  
  2374.                                March 23, 1992
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.         6-2                     CUT BUFFERS                      6-2
  2381.  
  2382.  
  2383.         6.2.  Pasting from a Cut Buffer
  2384.  
  2385.              There  are  two  styles  of  pasting:   line-mode   and
  2386.         character-mode.   If a cut buffer contains whole lines (from
  2387.         a command like "dd") then line-mode pasting is used;  if  it
  2388.         contains  partial  lines  (from  a  command  like "dw") then
  2389.         character-mode pasting is used.  The EX commands always  cut
  2390.         whole lines.
  2391.  
  2392.              Character-mode pasting causes the text to  be  inserted
  2393.         into the line that the cursor is on.
  2394.  
  2395.              Line-mode pasting inserts the text on a new line  above
  2396.         or  below the line that the cursor is on.  It doesn't affect
  2397.         the cursor's line at all.
  2398.  
  2399.              In visual mode, the p and P commands insert text from a
  2400.         cut  buffer.   Uppercase P will insert it before the cursor,
  2401.         and lowercase p will insert it after the cursor.   Normally,
  2402.         these  commands  will  paste from the "1 buffer, but you can
  2403.         specify any other buffer to paste from.  Just type its  name
  2404.         (a double-quote and another character) before you type the P
  2405.         or p.
  2406.  
  2407.              In EX mode, the (pu)t command pastes text after a given
  2408.         line.   To paste from a buffer other that "1, enter its name
  2409.         after the command.
  2410.  
  2411.         6.3.  Macros
  2412.  
  2413.              The contents of a named cut buffer can be executed as a
  2414.         series of ex/vi commands.
  2415.  
  2416.              To put the instructions into the cut buffer,  you  must
  2417.         first insert them into the file, and then delete them into a
  2418.         named cut buffer.
  2419.  
  2420.              To execute a cut buffer's contents as EX commands,  you
  2421.         should  give  the EX command "@" and the name of the buffer.
  2422.         For example, :@z will execute "z as a series of EX commands.
  2423.  
  2424.              To execute a cut buffer's contents as visual  commands,
  2425.         you should give the visual command "@" and the letter of the
  2426.         buffer's name.  The visual "@" command is different from the
  2427.         EX  "@"  command.   They interpret the cut buffer's contents
  2428.         differently.
  2429.  
  2430.              The visual @ command can be rather finicky.  Each char-
  2431.         acter  in the buffer is interpretted as a keystroke.  If you
  2432.         load the instructions into the cut buffer via  a  "zdd  com-
  2433.         mand, then the newline character at the end of the line will
  2434.         be executed just like any other  character,  so  the  cursor
  2435.         would be moved down 1 line.  If you don't want the cursor to
  2436.         move down 1 line at the end of each  @z  command,  then  you
  2437.  
  2438.  
  2439.  
  2440.                                March 23, 1992
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.         6-3                     CUT BUFFERS                      6-3
  2447.  
  2448.  
  2449.         should load the cut buffer by saying 0"zD instead.
  2450.  
  2451.              Although cut buffers can hold any amount of text, Elvis
  2452.         can  only  execute small buffers.  The size limit is roughly
  2453.         1000 characters, for either EX macros or VI  macros.   If  a
  2454.         buffer  is  too  large  to  execute,  an  error  message  is
  2455.         displayed.
  2456.  
  2457.              You can't nest :@ commands.  You can't run :@  commands
  2458.         from  your  .exrc  file,  or  any other :source file either.
  2459.         Similarly, you can't run a :source command from within an  @
  2460.         command.   Hopefully, these restrictions will be lifted in a
  2461.         later version.
  2462.  
  2463.         6.4.  The Effect of Switching Files
  2464.  
  2465.              When Elvis first starts up, all cut buffers are  empty.
  2466.         When  you  switch to a different file (via the :n or :e com-
  2467.         mands perhaps) the  9  anonymous  cut  buffers  are  emptied
  2468.         again,  but  the  other  27  buffers ("a through "z, and ".)
  2469.         retain their text.
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.                                March 23, 1992
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.         7.  DIFFERENCES BETWEEN Elvis & BSD VI/EX
  2516.  
  2517.              Elvis is not  100%  compatible  with  the  real  vi/ex.
  2518.         Elvis  has  many small extensions, some omissions, and a few
  2519.         features which  are  implemented  in  a  slightly  different
  2520.         manner.
  2521.  
  2522.         7.1.  Extensions
  2523.  
  2524.         Save Configuration
  2525.                   The :mkexrc command saves  the  current  :set  and
  2526.                   :map  configurations  in  the ".exrc" file in your
  2527.                   current directory.
  2528.  
  2529.         Previous File
  2530.                   The :N or :prev command  moves  backwards  through
  2531.                   the args list.
  2532.  
  2533.         Center Current Row
  2534.                   In visual command mode, the (lowercase) "zz"  com-
  2535.                   mand  will  center the current line on the screen,
  2536.                   like "z=".
  2537.  
  2538.         Changing Repeat Count
  2539.                   The default count value for . is the same  as  the
  2540.                   previous command which . is meant to repeat.  How-
  2541.                   ever, you can supply a new count if you wish.  For
  2542.                   example, after "3dw", "." will delete 3 words, but
  2543.                   "5." will delete 5 words.
  2544.  
  2545.         Previous Text
  2546.                   The text which was most recently input (via a "cw"
  2547.                   command,  or  something similar) is saved in a cut
  2548.                   buffer called ". (which is a pretty hard  name  to
  2549.                   write in an English sentence).
  2550.  
  2551.         Keyword Lookup
  2552.                   In visual command mode, you can  move  the  cursor
  2553.                   onto  a word and press shift-K to have Elvis run a
  2554.                   reference program to look that word up.  This com-
  2555.                   mand  alone  is worth the price of admission!  See
  2556.                   the ctags and ref programs.
  2557.  
  2558.         Increment/Decrement
  2559.                   In visual command mode, you can  move  the  cursor
  2560.                   onto  a  number and then hit ## or #+ to increment
  2561.                   that number by 1.  To increment  it  by  a  larger
  2562.                   amount, type in the increment value before hitting
  2563.                   the initial #.  The number can also be decremented
  2564.                   or set by hitting #- or #=, respectively.
  2565.  
  2566.         Input Mode
  2567.                   You can backspace past the beginning of the line.
  2568.  
  2569.  
  2570.  
  2571.  
  2572.                                March 23, 1992
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.         7-2        DIFFERENCES BETWEEN Elvis & BSD VI/EX         7-2
  2579.  
  2580.  
  2581.                   The arrow keys work in input mode.
  2582.  
  2583.                   If you type control-A,  then  the  text  that  you
  2584.                   input  last  time is inserted.  You will remain in
  2585.                   input mode, so you can backspace over part of  it,
  2586.                   or  add  more  to  it.   (This  is  sort  of  like
  2587.                   control-@ on the real vi,  except  that  control-A
  2588.                   really works.)
  2589.  
  2590.                   Control-P will insert  the  contents  of  the  cut
  2591.                   buffer.
  2592.  
  2593.                   Real vi can only remember up to 128 characters  of
  2594.                   input, but Elvis can remember any amount.
  2595.  
  2596.                   The ^T and ^D keys can adjust the indent of a line
  2597.                   no  matter  where the cursor happens to be in that
  2598.                   line.
  2599.  
  2600.                   You can save your file  and  exit  Elvis  directly
  2601.                   from input mode by hitting control-Z twice.
  2602.  
  2603.                   Elvis supports digraphs as a  way  to  enter  non-
  2604.                   ASCII characters.
  2605.  
  2606.         Start in Input Mode
  2607.                   If you ":set inputmode" in your .exrc  file,  then
  2608.                   Elvis  will  start  up  in  input  mode instead of
  2609.                   visual command mode.
  2610.  
  2611.         Visible Fonts
  2612.                   With   ":set   charattr",   Elvis   can    display
  2613.                   "backslash-f"  style  character  attributes on the
  2614.                   screen as you edit.  The following  example  shows
  2615.                   the recognized atributes:
  2616.  
  2617.                        normal      \fBboldface\fR      \fIitalics\fR
  2618.                   \fUunderlined\fR normal
  2619.  
  2620.                   NOTE:  you  must   compile   Elvis   without   the
  2621.                   -DNO_CHARATTR flag for this to work.
  2622.  
  2623.         File Syncing
  2624.                   After a crash, you can usually recover the altered
  2625.                   form  of  the  file  from  the temporary file that
  2626.                   Elvis uses -- unless the temporary file  was  cor-
  2627.                   rupted.
  2628.  
  2629.                   UNIX systems  use  a  delayed-write  cache,  which
  2630.                   means  that  when Elvis tries to write to the tem-
  2631.                   porary file, the information might still be in RAM
  2632.                   instead  of  on the disk.  A power failure at that
  2633.                   time would cause  the  in-RAM  information  to  be
  2634.                   lost.   UNIX's  sync()  call  will  force all such
  2635.  
  2636.  
  2637.  
  2638.                                March 23, 1992
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.         7-3        DIFFERENCES BETWEEN Elvis & BSD VI/EX         7-3
  2645.  
  2646.  
  2647.                   information to disk.
  2648.  
  2649.                   MS-DOS and Atari TOS don't write a  file's  length
  2650.                   to  disk until that file is closed.  Consequently,
  2651.                   the temporary file would appear to be 0 bytes long
  2652.                   if  power  failed  when we were editing.  To avoid
  2653.                   this problem, a sync() function has  been  written
  2654.                   which  will  close  the  temporary  file  and then
  2655.                   immediately reopen it.
  2656.  
  2657.         Cursor Shape
  2658.                   Elvis changes the shape of the cursor to  indicate
  2659.                   which  mode  you're in, if your terminal's termcap
  2660.                   entry includes the necessary capabilities.
  2661.  
  2662.         Hide nroff Lines
  2663.                   Th ":set hideformat"  option  hides  nroff  format
  2664.                   control  lines.  (They are displayed on the screen
  2665.                   as blank lines.)
  2666.  
  2667.         Compiler Interface
  2668.                   Elvis is clever enough to parse the error messages
  2669.                   emitted  by  many compilers.  To use this feature,
  2670.                   you should collect your compiler's error  messages
  2671.                   into a file called "errlist"; Elvis will read this
  2672.                   file, determine which source file caused the error
  2673.                   messages, start editing that file, move the cursor
  2674.                   to the line where  the  error  was  detected,  and
  2675.                   display  the  error  message  on  the status line.
  2676.                   Nifty!
  2677.  
  2678.         Visible Text Selection
  2679.                   In visual command mode, 'v' starts visibly select-
  2680.                   ing  characters  and  'V' starts visibly selecting
  2681.                   whole lines.  The character or line where the cur-
  2682.                   sor  is located becomes one endpoint of the selec-
  2683.                   tion.  You can then use the standard cursor  move-
  2684.                   ment commands to move the cursor to the other end-
  2685.                   point, and then press one of the operator commands
  2686.                   (c/d/y/</>/!/=/\).  The operator will then immedi-
  2687.                   ately be applied to the selected text.
  2688.  
  2689.         Pop-up Menu Operator
  2690.                   The '\' key is a new operator, similar  in  opera-
  2691.                   tion to the c/d/y/</>/! operators It conjures up a
  2692.                   menu, from which you can select any of  the  other
  2693.                   operators plus a few other common commands.
  2694.  
  2695.         Preset Filter Operator
  2696.                   The '=' key is another new operator.  It is  simi-
  2697.                   lar  to  the  '!'  operator, except that while '!'
  2698.                   asks you to type in a filter  command  each  time,
  2699.                   '='  assumes  it  should  always  run  the command
  2700.                   stored in the equalprg option.
  2701.  
  2702.  
  2703.  
  2704.                                March 23, 1992
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.         7-4        DIFFERENCES BETWEEN Elvis & BSD VI/EX         7-4
  2711.  
  2712.  
  2713.         Move to a Given Percentage
  2714.                   The '%' movement key can now  accept  an  optional
  2715.                   count.   Without  a count, the '%' key still moves
  2716.                   to a matching  parenthesis  like  it  always  did.
  2717.                   With  a count somewhere between 1 and 100, though,
  2718.                   it moves the cursor to approximately a given  per-
  2719.                   centage of the way through the file.  For example,
  2720.                   typing "50%" will move the cursor to the middle of
  2721.                   the file.
  2722.  
  2723.         Regular Expressions
  2724.                   In regular expressions, several new forms of  clo-
  2725.                   sure  operators  are  supported: \{n}, \{n,m}, \+,
  2726.                   and \?.
  2727.  
  2728.         7.2.  Omissions
  2729.  
  2730.              The replace mode is a hack.  It doesn't save  the  text
  2731.         that it overwrites.
  2732.  
  2733.              Long lines are displayed differently -- where the  real
  2734.         vi  would  wrap a long line onto several rows of the screen,
  2735.         Elvis simply displays part of the line, and  allows  you  to
  2736.         scroll the screen sideways to see the rest of it.
  2737.  
  2738.              The ":preserve" and ":recover"  commands  are  missing.
  2739.         So  is  the  -r  flag.   I've never had a good reason to use
  2740.         ":preserve", and  since  ":recover"  is  used  so  rarely  I
  2741.         decided  to  implement it as a separate program.  There's no
  2742.         need to load the recovery code into memory  every  time  you
  2743.         edit a file, I figured.
  2744.  
  2745.              LISP support is missing.  However, the = key  is  still
  2746.         an  operator  that  reformats lines of text.  By default, it
  2747.         reformats lines by sending them through the fmt filter,  but
  2748.         you could write your own LISP beautifier and configure elvis
  2749.         to use it.  Key mappings  could  take  care  of  most  other
  2750.         differences.  Auto-indent is the only thing that is irrecov-
  2751.         erably lost.
  2752.  
  2753.              Autoindent mode acts a little different from  the  real
  2754.         vi, anyway.  It doesn't handle ^^D or 0^D correctly.  On the
  2755.         other hand, it does allow ^D and ^T to be used  anywhere  in
  2756.         the line, to adjust the indentation for the whole line.
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.                                March 23, 1992
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.         8.  INTERNAL
  2780.  
  2781.              You don't need to know the material in this section  to
  2782.         use Elvis.  You only need it if you intend to modify Elvis.
  2783.  
  2784.              You should also check out the CFLAGS, TERMCAP, ENVIRON-
  2785.         MENT  VARIABLES, VERSIONS, and QUIESTIONS & ANSWERS sections
  2786.         of this manual.
  2787.  
  2788.         8.1.  The temporary file
  2789.  
  2790.              The temporary file is divided into blocks of 1024 bytes
  2791.         each.  The functions in "blk.c" maintain a cache of the five
  2792.         most recently used blocks, to minimize file I/O.
  2793.  
  2794.              When Elvis starts up, the file is copied into the  tem-
  2795.         porary  file  by  the function tmpstart() in "tmp.c".  Small
  2796.         amounts of extra space are inserted into the temporary  file
  2797.         to  insure  that no text lines cross block boundaries.  This
  2798.         speeds up processing and simplifies storage management.  The
  2799.         extra  space  is filled with NUL characters.  the input file
  2800.         must not contain any NULs, to avoid  confusion.   This  also
  2801.         limits lines to a length of 1023 characters or less.
  2802.  
  2803.              The data blocks aren't necessarily stored in  sequence.
  2804.         For  example,  it  is  entirely possible that the data block
  2805.         containing the first lines of text will be stored after  the
  2806.         block containing the last lines of text.
  2807.  
  2808.              In RAM, Elvis maintains two lists: one  that  describes
  2809.         the  "proper"  order  of  the  disk blocks, and another that
  2810.         records the line number of the  last  line  in  each  block.
  2811.         When  Elvis  needs  to  fetch  a given line of text, it uses
  2812.         these tables to locate the data block  which  contains  that
  2813.         line.
  2814.  
  2815.              Before each change is made to the file, these lists are
  2816.         copied.  The copies can be used to "undo" the change.  Also,
  2817.         the first list -- the one that  lists  the  data  blocks  in
  2818.         their  proper order -- is written to the first data block of
  2819.         the temp file.  This list can be used during file recovery.
  2820.  
  2821.              When blocks are altered, they are rewritten to  a  dif-
  2822.         ferent  block  in  the  file,  and the order list is updated
  2823.         accordingly.  The original block is  left  intact,  so  that
  2824.         "undo"  can  be  performed  easily.   Elvis  will eventually
  2825.         reclaim the original block, when it is no longer needed.
  2826.  
  2827.         8.2.  Implementation of Editing
  2828.  
  2829.              There are three basic operations which affect text:
  2830.  
  2831.                 + delete text   - delete(from, to)
  2832.                 + add text      - add(at, text)
  2833.  
  2834.  
  2835.  
  2836.                                March 23, 1992
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.         8-2                       INTERNAL                       8-2
  2843.  
  2844.  
  2845.                 + yank text     - cut(from, to)
  2846.  
  2847.  
  2848.              To yank text, all text between two  text  positions  is
  2849.         copied into a cut buffer.  The original text is not changed.
  2850.         To copy the text into a cut buffer, you need  only  remember
  2851.         which  physical blocks that contain the cut text, the offset
  2852.         into the first block of the start of  the  cut,  the  offset
  2853.         into  the last block of the end of the cut, and what kind of
  2854.         cut it was.  (Cuts may be  either  character  cuts  or  line
  2855.         cuts;  the kind of a cut affects the way it is later "put".)
  2856.         Yanking is implemented in the function cut(), and pasting is
  2857.         implemented  in  the  function paste().  These functions are
  2858.         defined in "cut.c".
  2859.  
  2860.              To delete text, you must  modify  the  first  and  last
  2861.         blocks,  and  remove any reference to the intervening blocks
  2862.         in the header's list.  The text to be deleted  is  specified
  2863.         by two marks.  This is implemented in the function delete().
  2864.  
  2865.              To add text, you must specify the text to insert (as  a
  2866.         NUL-terminated  string)  and  the  place  to insert it (as a
  2867.         mark).  The block into which the text is to be inserted  may
  2868.         need  to  be  split  into  as  many as four blocks, with new
  2869.         intervening blocks needed as well...  or it could be as sim-
  2870.         ple as modifying a single block.  This is implemented in the
  2871.         function add().
  2872.  
  2873.              There is also a change() function, which generally just
  2874.         calls delete() and add().  For the special case where a sin-
  2875.         gle character is being replaced by another single character,
  2876.         though,  change() will optimize things somewhat.  The add(),
  2877.         delete(),  and  change()  functions  are  all   defined   in
  2878.         "modify.c".
  2879.  
  2880.              The input() function reads text from a user and inserts
  2881.         it  into  the  file.   It  makes  heavy  use  of  the add(),
  2882.         delete(), and change() functions.  It inserts characters one
  2883.         at a time, as they are typed.
  2884.  
  2885.              When  text  is  modified,  an  internal   file-revision
  2886.         counter,  called  changes,  is incremented.  This counter is
  2887.         used to detect when certain caches are out  of  date.   (The
  2888.         "changes"  counter  is  also incremented when we switch to a
  2889.         different file, and also in one or two similar situations --
  2890.         all related to invalidating caches.)
  2891.  
  2892.         8.3.  Marks and the Cursor
  2893.  
  2894.              Marks are places within the text.  They are represented
  2895.         internally  as  32-bit  values which are split into two bit-
  2896.         fields: a line number and a character index.   Line  numbers
  2897.         start with 1, and character indexes start with 0.  Lines can
  2898.         be up to 1023 characters long, so the character index is  10
  2899.  
  2900.  
  2901.  
  2902.                                March 23, 1992
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.         8-3                       INTERNAL                       8-3
  2909.  
  2910.  
  2911.         bits wide and the line number fills the remaining 22 bits in
  2912.         the long int.
  2913.  
  2914.              Since line numbers start with 1, it is impossible for a
  2915.         valid  mark  to have a value of 0L.  0L is therefore used to
  2916.         represent unset marks.
  2917.  
  2918.              When you do the "delete text" change,  any  marks  that
  2919.         were  part of the deleted text are unset, and any marks that
  2920.         were set  to  points  after  it  are  adjusted.   Marks  are
  2921.         adjusted similarly after new text is inserted.
  2922.  
  2923.              The cursor is represented as a mark.
  2924.  
  2925.         8.4.  Colon Command Interpretation
  2926.  
  2927.              Colon commands are parsed,  and  the  command  name  is
  2928.         looked  up  in  an  array of structures which also contain a
  2929.         pointer to the function that implements the command,  and  a
  2930.         description  of the arguments that the command can take.  If
  2931.         the command is recognized and its arguments are legal,  then
  2932.         the function is called.
  2933.  
  2934.              Each function performs its task;  this  may  cause  the
  2935.         cursor to be moved to a different line, or whatever.
  2936.  
  2937.         8.5.  Screen Control
  2938.  
  2939.              In input mode or visual command  mode,  the  screen  is
  2940.         redrawn  by  a  function  called redraw().  This function is
  2941.         called in the getkey() function  before  each  keystroke  is
  2942.         read in, if necessary.
  2943.  
  2944.              Redraw() write to the screen via a package which  looks
  2945.         like  the  "curses" library, but isn't.  It is actually much
  2946.         simpler.  Most curses operations are implemented  as  macros
  2947.         which copy characters into a large I/O buffer, which is then
  2948.         written with a single large write()  call  as  part  of  the
  2949.         refresh() operation.
  2950.  
  2951.              (Note: Under MS-DOS, the pseudo-curses macros check  to
  2952.         see  whether you're using the pcbios interface.  If you are,
  2953.         then the macros call functions in "pc.c" to implement screen
  2954.         updates.)
  2955.  
  2956.              The  low-level  functions  which  modify  text  (namely
  2957.         add(), delete(), and change()) supply redraw() with clues to
  2958.         help redraw() decide which  parts  of  the  screen  must  be
  2959.         redrawn.    The  clues  are  given  via  a  function  called
  2960.         redrawrange().
  2961.  
  2962.              Most EX commands use the pseudo-curses package to  per-
  2963.         form their output, like redraw().
  2964.  
  2965.  
  2966.  
  2967.  
  2968.                                March 23, 1992
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.         8-4                       INTERNAL                       8-4
  2975.  
  2976.  
  2977.              There is also a function called msg()  which  uses  the
  2978.         same  syntax  as printf().  In EX mode, msg() writes message
  2979.         to the screen and automatically adds a newline.  In VI mode,
  2980.         msg()  writes  the  message on the bottom line of the screen
  2981.         with the "standout" character attribute turned on.
  2982.  
  2983.         8.6.  Options
  2984.  
  2985.              For each option available through the  ":set"  command,
  2986.         Elvis contains a character array variable, named "o_option".
  2987.         For example, the  "lines"  option  uses  a  variable  called
  2988.         "o_lines".
  2989.  
  2990.              For boolean options, the array has a  dimension  of  1.
  2991.         The  first  (and only) character of the array will be NUL if
  2992.         the variable's value is FALSE, and some other value if it is
  2993.         TRUE.   To  check  the  value, just by dereference the array
  2994.         name, as in "if (*o_autoindent)".
  2995.  
  2996.              For number options, the array has  a  dimension  of  3.
  2997.         The  array  is  treated as three unsigned one-byte integers.
  2998.         The first byte is the current  value  of  the  option.   The
  2999.         second  and  third  bytes  are the lower and upper bounds of
  3000.         that option.
  3001.  
  3002.              For string options, the array usually has  a  dimension
  3003.         of about 60 but this may vary.  The option's value is stored
  3004.         as a normal NUL-terminated string.
  3005.  
  3006.              All of the options are declared in "opts.c".  Most  are
  3007.         initialized to their default values; the initopts() function
  3008.         is used to perform any environment-specific initialization.
  3009.  
  3010.         8.7.  Portability
  3011.  
  3012.              To improve portability, Elvis collects as many  of  the
  3013.         system-dependent definitions as possible into the "config.h"
  3014.         file.  This file begins with some preprocessor  instructions
  3015.         which attempt to determine which compiler and operating sys-
  3016.         tem you have.  After that,  it  conditionally  defines  some
  3017.         macros and constants for your system.
  3018.  
  3019.              One of the more significant macros is ttyread().   This
  3020.         macro is used to read raw characters from the keyboard, pos-
  3021.         sibly with timeout.  For UNIX systems, this basically  reads
  3022.         bytes  from  stdin.  For MSDOS, TOS, and OS9, ttyread() is a
  3023.         function defined in curses.c.  There is  also  a  ttywrite()
  3024.         macro.
  3025.  
  3026.              The tread() and twrite() macros are versions of  read()
  3027.         and  write() that are used for text files.  On UNIX systems,
  3028.         these are equivelent to  read()  and  write().   On  MS-DOS,
  3029.         these  are  also equivelent to read() and write(), since DOS
  3030.         libraries are generally clever  enough  to  convert  newline
  3031.  
  3032.  
  3033.  
  3034.                                March 23, 1992
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.         8-5                       INTERNAL                       8-5
  3041.  
  3042.  
  3043.         characters  automatically.   For  Atari TOS, though, the MWC
  3044.         library is too stupid to do  this,  so  we  had  to  do  the
  3045.         conversion explicitly.
  3046.  
  3047.              Other macros may substitute index()  for  strchr(),  or
  3048.         bcopy()  for memcpy(), or map the "void" data type to "int",
  3049.         or whatever.
  3050.  
  3051.              The file "tinytcap.c" contains a set of functions  that
  3052.         emulate  the  termcap  library  for  a small set of terminal
  3053.         types.  The terminal-specific info is hard-coded  into  this
  3054.         file.   It  is only used for systems that don't support real
  3055.         termcap.  Another alternative for screen control can be seen
  3056.         in  the  "curses.h"  and  "pc.c"  files.  Here, macros named
  3057.         VOIDBIOS and CHECKBIOS are used to indirectly call functions
  3058.         which perform low-level screen manipulation via BIOS calls.
  3059.  
  3060.              The stat() function must be able to come up with  UNIX-
  3061.         style  major/minor/inode  numbers  that  uniquely identify a
  3062.         file or directory.
  3063.  
  3064.              Please try to keep you changes localized, and wrap them
  3065.         in  #if/#endif pairs, so that Elvis can still be compiled on
  3066.         other systems.  And PLEASE let me know about it,  so  I  can
  3067.         incorporate your changes into my latest-and-greatest version
  3068.         of Elvis.
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.                                March 23, 1992
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.         9.  CFLAGS
  3110.  
  3111.              Elvis uses many preprocessor symbols to control  compi-
  3112.         lation.   Some  of  these  control  the sizes of buffers and
  3113.         such.  The "-DNO_XXXX" options remove small sets of  related
  3114.         features.
  3115.  
  3116.              Most  Elvis  users  will  probably  want  to  keep  all
  3117.         features  available.   Minix-PC  users, though, will have to
  3118.         sacrifice some sets because otherwise  Elvis  would  be  too
  3119.         bulky  to  compile.   The "asld" phase of the compiler craps
  3120.         out.
  3121.  
  3122.         -DM_SYSV, -Dbsd, -DTOS, -DCOHERENT, -Damiga
  3123.              These flags tell the compiler that Elvis is being  com-
  3124.              piled for System-V UNIX, BSD UNIX, Atari TOS, Coherent,
  3125.              or AmigaDos,  respectively.   For  other  systems,  the
  3126.              config.h  file  can  generally  figure it out automati-
  3127.              cally.
  3128.  
  3129.         -DRAINBOW
  3130.              For MS-DOS systems, this causes  support  for  the  DEC
  3131.              Rainbow to be compiled into Elvis.
  3132.  
  3133.         -DS5WINSIZE
  3134.              Some versions of SysV UNIX don't  support  support  the
  3135.              "winsize"   style  of  screen-size  testing,  so  elvis
  3136.              ignores window size changes by default.
  3137.  
  3138.              However, many of the newer SysV systems  defines  "win-
  3139.              size"  in  the file "/usr/include/sys/ptem.h".  If your
  3140.              SysV  system  has  "winsize"  then   you   should   add
  3141.              -DS5SWINSIZE to the CFLAGS setting.
  3142.  
  3143.         -DTERMIOS
  3144.              POSIX is a SysV-derived specification which uses a ter-
  3145.              minal  control  package  called  "termios",  instead of
  3146.              "termio".  Some other SysV systems may  also  use  ter-
  3147.              mios.   You  can make elvis uses termios instead of the
  3148.              more common  termio  by  adding  -DTERMIOS  to  CFLAGS.
  3149.              (Note: This hasn't been tested very well.)
  3150.  
  3151.         -DNBUFS=number
  3152.              Elvis keeps most of your text in a temporary file; only
  3153.              a  small  amount  is actually stored in RAM.  This flag
  3154.              allows you to control how much of the file  can  be  in
  3155.              RAM  at  any  time.   The  default is 5 blocks, and the
  3156.              minimum is 3 blocks.  (See the -DBLKSIZE flag, below.)
  3157.  
  3158.              More RAM allows global changes to happen a little  fas-
  3159.              ter.
  3160.               f you're just making many small changes in one section
  3161.              of a file, though, extra RAM won't help much.
  3162.  
  3163.  
  3164.  
  3165.  
  3166.                                March 23, 1992
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.         9-2                        CFLAGS                        9-2
  3173.  
  3174.  
  3175.         -DBLKSIZE=number
  3176.              This controls the size of blocks that Elvis uses inter-
  3177.              nally.   The  value  of BLKSIZE must be a power of two.
  3178.              Every time you double BLKSIZE, you quadruple  the  size
  3179.              of  a  text  file  that  Elvis can handle, but you also
  3180.              cause the temporary file to grow faster.   For  MS-DOS,
  3181.              Coherent,  and  Minix-PC,  the  default  value is 1024,
  3182.              which allows you to edit files up to almost 512K  bytes
  3183.              long.   For  all  other  systems,  the default value is
  3184.              2048, which allows you to edit files that are nearly  2
  3185.              megabytes long.
  3186.  
  3187.              The BLKSIZE also determines the  maximum  line  length,
  3188.              and  a few other limits.  BLKSIZE should be either 256,
  3189.              512, 1024, or 2048.  Values other than these  can  lead
  3190.              to strange behaviour.
  3191.  
  3192.         -DTMPDIR=string
  3193.              This sets the default value of the "directory"  option,
  3194.              which   specifies  where  the  temporary  files  should
  3195.              reside.  The value of TMPDIR must be a  string,  so  be
  3196.              sure  your  value includes the quote characters on each
  3197.              end.
  3198.  
  3199.         -DEXRC=str, -DHMEXRC=str, -DSYSEXRC=str, -DEXINIT=str
  3200.              This lets you control the names of  the  initialization
  3201.              files.   Their  values  must  be strings, so be careful
  3202.              about quoting.
  3203.  
  3204.              EXRC is the name of  the  initialization  file  in  the
  3205.              current  directory.   Its  default  value is ".exrc" on
  3206.              UNIX systems -- the same as the real  vi.   Since  that
  3207.              isn't  a  legal  DOS filename, under DOS the default is
  3208.              "elvis.rc".  For  other  systems,  check  the  config.h
  3209.              file.
  3210.  
  3211.              HMEXRC is the name of the initialization file  in  your
  3212.              home  directory.   By  default, it is the same as EXRC.
  3213.              Elvis will automatically prepend the name of your  home
  3214.              directory  to  HMEXRC at run time, so don't give a full
  3215.              path name.
  3216.  
  3217.              SYSEXRC is the name  of  a  system-wide  initialization
  3218.              file.   It  has no default value; if you don't define a
  3219.              value for it, then the code that supports SYSEXRC  just
  3220.              isn't  compiled.  The value of SYSEXRC should be a full
  3221.              pathname, in quotes.
  3222.  
  3223.              EXINIT is the name of an environment variable that  can
  3224.              contain  initialization  commands.  Normally, its value
  3225.              is "EXINIT".
  3226.  
  3227.         -DKEYWORDPRG=string
  3228.              This  flag  determines  the  default   value   of   the
  3229.  
  3230.  
  3231.  
  3232.                                March 23, 1992
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.         9-3                        CFLAGS                        9-3
  3239.  
  3240.  
  3241.              "keywordprg" option.  Its value must be a string, so be
  3242.              careful about quoting.  The default value of this  flag
  3243.              is "ref", which is a C reference program.
  3244.  
  3245.         -DCC_COMMAND=string -DMAKE_COMMAND=string -DERRLIST=string
  3246.              These control the names of the C compiler,  the  "make"
  3247.              utility, and the error output file, respectively.  They
  3248.              are only used if -DNO_ERRLIST is not given.
  3249.  
  3250.              The default value of CC_COMMAND depends on the  Operat-
  3251.              ing  System and compiler that you use to compile elvis;
  3252.              for UNIX, the default is "cc".  The default  values  of
  3253.              MAKE_COMMAND  and  ERRLIST  are  "make"  and "errlist",
  3254.              respectively.
  3255.  
  3256.         -DMAXRCLEN=number
  3257.              This determines how large a :@  macro  command  can  be
  3258.              (measured  in  bytes).   The default is 1000 bytes.  If
  3259.              you increase this value  significantly,  then  you  may
  3260.              need  to  allocate extra memory for the stack.  See the
  3261.              "CHMEM" setting in the Makefile.
  3262.  
  3263.         -DSHELL=string
  3264.              This is the default value of the  "shell"  option,  and
  3265.              hence  the  default shell used from within Elvis.  This
  3266.              only controls the default; the value you give here  may
  3267.              be  overridden  at  run-time  by setting an environment
  3268.              variable named SHELL  (or  COMSPEC  for  MS-DOS).   Its
  3269.              value  must  be  a string constant, so be careful about
  3270.              quoting.
  3271.  
  3272.         -DTAGS=string
  3273.              This sets the name of the "tags" file, which is used by
  3274.              the :tag command.  Its value must be a string constant,
  3275.              so be careful about quoting.
  3276.  
  3277.         -DCS_IBMPC -DCS_LATIN1 -DCS_SPECIAL
  3278.              The digraph table and  flipcase  option  will  normally
  3279.              start  out  empty.   However,  if you add -DCS_IBMPC or
  3280.              -DCS_LATIN1 to your CFLAGS, then they  will  start  out
  3281.              filled  with values that are appropriate for the IBM PC
  3282.              character set or the ISO Latin-1 character set, respec-
  3283.              tively.
  3284.  
  3285.              You can also use -DCS_IBMPC and  -DCS_SPECIAL  together
  3286.              to  get  digraphs that produce the PC's graphic charac-
  3287.              ters.
  3288.  
  3289.         -DDEBUG -DEBUG2
  3290.              -DDEBUG adds the ":debug" and ":validate" commands, and
  3291.              also   adds   many  internal  consistency  checks.   It
  3292.              increases the size of the ".text" segment by about 6K.
  3293.  
  3294.              -DDEBUG2 causes a line to be appended to a file  called
  3295.  
  3296.  
  3297.  
  3298.                                March 23, 1992
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.         9-4                        CFLAGS                        9-4
  3305.  
  3306.  
  3307.              "debug.out"  everytime  any  change is made to the edit
  3308.              buffer.
  3309.  
  3310.         -DCRUNCH
  3311.              This flag removes some non-critical code, so that Elvis
  3312.              is  smaller.   For example, it removes a short-cut from
  3313.              the regexp package, so that text searches  are  slower.
  3314.              Also, screen updates are not as efficient.  A couple of
  3315.              obscure features are disabled by this, too.
  3316.  
  3317.         -DNO_MKEXRC
  3318.              This removes the ":mkexrc"  command,  so  you  have  to
  3319.              create any .exrc files manually.  The size of the .text
  3320.              segment will be reduced by about 600 bytes.
  3321.  
  3322.         -DNO_CHARATTR
  3323.              Permanently disables the charattr option.  This reduces
  3324.              the size of your ".text" segment by about 850 bytes.
  3325.  
  3326.         -DNO_RECYCLE
  3327.              Normally, Elvis will recycle space (from the  temporary
  3328.              file)  which contains totally obsolete text.  This flag
  3329.              disables  this  recycling.   Without   recycling,   the
  3330.              ".text"  segment is about 1K smaller than it would oth-
  3331.              erwise be, but the tmp file grows much faster.  If  you
  3332.              have  a  lot of free space on your hard disk, but Elvis
  3333.              is too bulky to run with recycling, then try it without
  3334.              recycling.
  3335.  
  3336.              When using a version of Elvis that  has  been  compiled
  3337.              with  -DNO_RECYCLE, you should be careful to avoid mak-
  3338.              ing many small changes to a file because  each  indivi-
  3339.              dual change will cause the tmp file to grow by at least
  3340.              1k.  Hitting "x" thirty times counts as thirty changes,
  3341.              but  typing  "30x"  counts  as  one  change.  Also, you
  3342.              should occasionally do a ":w" followed  by  a  ":e"  to
  3343.              start with a fresh tmp file.
  3344.  
  3345.              Interestingly, the real vi never  recycles  space  from
  3346.              its temporary file.
  3347.  
  3348.         -DNO_SENTENCE
  3349.              Leaves out the "(" and ")" visual mode commands.  Also,
  3350.              the  "[[",  "]]", "{", and "}" commands will not recog-
  3351.              nize *roff macros.  The sections and paragraphs options
  3352.              go  away.   This  saves  about 650 bytes in the ".text"
  3353.              segment.
  3354.  
  3355.         -DNO_CHARSEARCH
  3356.              Leaves out the visual commands  which  locate  a  given
  3357.              character  in the current line: "f", "t", "F", "T", ","
  3358.              and ";".  This saves about 900 bytes.
  3359.  
  3360.         -DNO_EXTENSIONS
  3361.  
  3362.  
  3363.  
  3364.                                March 23, 1992
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.         9-5                        CFLAGS                        9-5
  3371.  
  3372.  
  3373.              Leaves out the "K" and "#" visual commands.  Also,  the
  3374.              arrow  keys will no longer work in input mode.  Regular
  3375.              expressions will no longer recognize the \{\} operator.
  3376.              (Other  extensions are either inherent in the design of
  3377.              Elvis, or are controlled by more specific flags, or are
  3378.              too  tiny  to  be worth removing.) This saves about 250
  3379.              bytes.
  3380.  
  3381.         -DNO_MAGIC
  3382.              Permanently disables the "magic" option, so  that  most
  3383.              meta-characters  in  a  regular  expression  are  *NOT*
  3384.              recognized.  This  saves  about  3k  of  space  in  the
  3385.              ".text" segment, because the complex regular expression
  3386.              code can be replaced by much simpler code.
  3387.  
  3388.         -DNO_SHOWMODE
  3389.              Permanently  disables  the  "showmode"  option,  saving
  3390.              about 250 bytes.
  3391.  
  3392.         -DNO_CURSORSHAPE
  3393.              Normally, Elvis tries to adjust the shape of the cursor
  3394.              as   a   reminder   of   which  mode  you're  in.   The
  3395.              -DNO_CURSORSHAPE flag disables this, saving  about  150
  3396.              bytes.
  3397.  
  3398.         -DNO_DIGRAPH
  3399.              To allow entry of non-ASCII characters, Elvis  supports
  3400.              digraphs.   A digraph is a single (non-ASCII) character
  3401.              which is entered as a combination of two other  (ASCII)
  3402.              characters.  If you don't need to input non-ASCII char-
  3403.              acters, or if your keyboard supports a  better  way  of
  3404.              entering non-ASCII characters, then you can disable the
  3405.              digraph code and save about 450 bytes.
  3406.  
  3407.         -DNO_ERRLIST
  3408.              Elvis adds a ":errlist" command,  which  is  useful  to
  3409.              programmers.   If  you don't need this feature, you can
  3410.              disable it via the -DNO_ERRLIST flag.  This will reduce
  3411.              the .text segment by about 900 bytes, and the .bss seg-
  3412.              ment by about 300 bytes.
  3413.  
  3414.         -DNO_ABBR
  3415.              The -DNO_ABBR flag disables the  ":abbr"  command,  and
  3416.              reduces the size of Elvis by about 250 bytes.
  3417.  
  3418.         -DNO_OPTCOLS
  3419.              When Elvis displays the current  options  settings  via
  3420.              the  ":set"  command,  the  options are normally sorted
  3421.              into columns.  The -DNO_OPTCOLS flag causes the options
  3422.              to be sorted across the rows, which is much simpler for
  3423.              the computer.  The -DNO_OPTCOLS flag  will  reduce  the
  3424.              size of your .text segment by about 500 bytes.
  3425.  
  3426.         -DNO_MODELINES
  3427.  
  3428.  
  3429.  
  3430.                                March 23, 1992
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.         9-6                        CFLAGS                        9-6
  3437.  
  3438.  
  3439.              This removes all support for modelines.
  3440.  
  3441.         -DNO_TAG
  3442.              This disables tag lookup.  It reduces the size  of  the
  3443.              .text segment by about 750 bytes.
  3444.  
  3445.         -DNO_ALT_FKEY -DNO_CTRL_FKEY -DNO_SHIFT_FKEY -DNO_FKEY
  3446.              These remove explicit  support  of  function  keys.   -
  3447.              DNO_ALT_FKEY  removes  support for the <alternate> ver-
  3448.              sions function keys.   -DNO_CTRL_FKEY  removes  support
  3449.              for  the  <control>  and  <alternate> versions function
  3450.              keys.  -DNO_SHIFT_FKEY removes support for the <shift>,
  3451.              <control>,  and  <alternate> versions function keys.  -
  3452.              DNO_FKEY removes all support of function keys.
  3453.  
  3454.              Elvis's ":map" command normally allows you to  use  the
  3455.              special  sequence  "#<n>" to map function key <n>.  For
  3456.              example, ":map #1 {!}fmt^M" will cause the <F1> key  to
  3457.              reformat  a paragraph.  Elvis checks the :k1=: field in
  3458.              the termcap description of your terminal to figure  out
  3459.              what  code  is  sent  by  the  <F1> key.  This is handy
  3460.              because it allows you to create a .exrc file which maps
  3461.              function  keys  the same way regardless of what type of
  3462.              terminal you use.
  3463.  
  3464.              That behaviour is standard; most implementations of the
  3465.              real  vi  supports it too.  Elvis extends this to allow
  3466.              you to use "#1s" to refer  to  <shift>+<F1>,  "#1c"  to
  3467.              refer   to   <control>+<F1>,  and  "#1a"  to  refer  to
  3468.              <alt>+<F1>.  The termcap description for  the  terminal
  3469.              should have fields named :s1=:c1=:a1=: respectively, to
  3470.              define the code sent by these key  conbinations.   (You
  3471.              should  also  have  :k2=:s2=:c2=:a2=: for the <F2> key,
  3472.              and so on.)
  3473.  
  3474.              But there  may  be  problems.   The  terminfo  database
  3475.              doesn't  support :s1=:c1=:a1=:, so no terminfo terminal
  3476.              description could ever support shift/control/alt  func-
  3477.              tion  keys; so you might as well add -DNO_SHIFT_FKEY to
  3478.              CFLAGS if you're using terminfo.
  3479.  
  3480.              Note that, even if you have -DNO_FKEYS, you  can  still
  3481.              configure  Elvis  to  use your function keys my mapping
  3482.              the literal character codes sent by the key.  You  just
  3483.              couldn't do it in a terminal-independent way.  TERM_925
  3484.  
  3485.         -DTERM_AMIGA -DTERM_VT100 -DTERM_VT52 etc.
  3486.              The tinytcap.c file contains  descriptions  of  several
  3487.              terminal  types.  For each system that uses tinytcap, a
  3488.              reasonable subset  of  the  available  descriptions  is
  3489.              actually  compiled  into Elvis.  If you wish to enlarge
  3490.              this  subset,  then  you  can   add   the   appropriate
  3491.              -DTERM_XXX flag to your CFLAGS settings.
  3492.  
  3493.  
  3494.  
  3495.  
  3496.                                March 23, 1992
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.         9-7                        CFLAGS                        9-7
  3503.  
  3504.  
  3505.              For a list of the available terminal types,  check  the
  3506.              tinytcap.c file.
  3507.  
  3508.         -DINTERNAL_TAGS
  3509.              Normally, Elvis uses the "ref" program to  perform  tag
  3510.              lookup.   This  is more powerful than the real vi's tag
  3511.              lookup, but it can be much slower.
  3512.  
  3513.              If you add -DINTERNAL_TAGS to your CFLAGS setting, then
  3514.              will  use  its  own  internal tag lookup code, which is
  3515.              faster.
  3516.  
  3517.         -DPRSVDIR=directory
  3518.              This controls where preserved files will be placed.  An
  3519.              appropriate  default has been chosen for each Operating
  3520.              System, so you probably don't need to worry about it.
  3521.  
  3522.         -DFILEPERMS=number
  3523.              This affects the attributes of files that  are  created
  3524.              by  Elvis;  it  is  used  as the second argument to the
  3525.              creat() function.  The default is 0666 which  (on  UNIX
  3526.              systems  at least) means that anybody can read or write
  3527.              the new file, but nobody can execute it.  On UNIX  sys-
  3528.              tems, the creat() call modifies this via the umask set-
  3529.              ting.
  3530.  
  3531.         -DKEYBUFSIZE=number
  3532.              This determines the size of the type-ahead buffer  that
  3533.              elvis uses.  It also limits the size of keymaps that it
  3534.              can handle.  The  default  is  1000  characters,  which
  3535.              should be plenty.
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.                                March 23, 1992
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.         10.  TERMCAP
  3572.  
  3573.              Elvis uses fairly  standard  termcap  fields  for  most
  3574.         things.   I  invented  the cursor shape names but other than
  3575.         that there should be few surprises.
  3576.  
  3577.         Required numeric fields
  3578.  
  3579.             :co#:   number of columns on the screen (chars per line)
  3580.             :li#:   number of lines on the screen
  3581.  
  3582.  
  3583.         Required string fields
  3584.  
  3585.             :ce=:   clear to end-of-line
  3586.             :cl=:   home the cursor & clear the screen
  3587.             :cm=:   move the cursor to a given row/column
  3588.             :up=:   move the cursor up one line
  3589.  
  3590.  
  3591.         Boolean fields
  3592.  
  3593.             :am:    auto margins - wrap when char is written in last column?
  3594.             :xn:    brain-damaged auto margins - newline ignored after wrap
  3595.             :pt:    physical tabs?
  3596.  
  3597.  
  3598.         Optional string fields
  3599.  
  3600.             :al=:   insert a blank row on the screen
  3601.             :dl=:   delete a row from the screen
  3602.             :cd=:   clear to end of display
  3603.             :ei=:   end insert mode
  3604.             :ic=:   insert a blank character
  3605.             :im=:   start insert mode
  3606.             :dc=:   delete a character
  3607.             :sr=:   scroll reverse (insert row at top of screen)
  3608.             :vb=:   visible bell
  3609.             :ti=:   terminal initialization string, to start full-screen mode
  3610.             :te=:   terminal termination, to end full-screen mode
  3611.             :ks=:   enables the cursor keypad
  3612.             :ke=:   disables the cursor keypad
  3613.  
  3614.  
  3615.         Optional strings received from the keyboard
  3616.  
  3617.             :kd=:   sequence sent by the <down arrow> key
  3618.             :kl=:   sequence sent by the <left arrow> key
  3619.             :kr=:   sequence sent by the <right arrow> key
  3620.             :ku=:   sequence sent by the <up arrow> key
  3621.             :kP=:   sequence sent by the <PgUp> key
  3622.             :kN=:   sequence sent by the <PgDn> key
  3623.             :kh=:   sequence sent by the <Home> key
  3624.             :kH=:   sequence sent by the <End> key
  3625.             :kI=:   sequence sent by the <Insert> key
  3626.  
  3627.  
  3628.                            March 23, 1992
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.         10-2                      TERMCAP                       10-2
  3635.  
  3636.  
  3637.  
  3638.              Originally, termcap  didn't  have  any  names  for  the
  3639.         <PgUp>,  <PgDn>, <Home>, and <End> keys.  Although the capa-
  3640.         bility names shown in the table above are the  most  common,
  3641.         they  are  not  universal.  SCO Xenix uses :PU=:PD=:HM=:EN=:
  3642.         for those keys.  Also, if the four arrow keys happen  to  be
  3643.         part  of  a  3x3 keypad, then the five non-arrow keys may be
  3644.         named :K1=: through :K5=:, so an  IBM  PC  keyboard  may  be
  3645.         described  using those names instead.  Elvis can find any of
  3646.         these names.
  3647.  
  3648.         Optional strings sent by function keys
  3649.  
  3650.             :k1=:...:k9=:k0=:       codes sent by <F1> through <F10> keys
  3651.             :s1=:...:s9=:s0=:       codes sent by <Shift F1> ... <Shift F10>
  3652.             :c1=:...:c9=:c0=:       codes sent by <Ctrl F1> ... <Ctrl F10>
  3653.             :a1=:...:a9=:a0=:       codes sent by <Alt F1> ... <Alt F10>
  3654.  
  3655.  
  3656.              Note that :k0=: is used  to  describe  the  <F10>  key.
  3657.         Some  termcap  documents  recommend  :ka=: or even :k;=: for
  3658.         describing the <F10> key, but Elvis doesn't support that.
  3659.  
  3660.              Also, the :s1=:..., :c1=:..., and  :a1=:...  codes  are
  3661.         very  non-standard.   The  terminfo  library doesn't support
  3662.         them.
  3663.  
  3664.         Optional fields that describe character attributes
  3665.  
  3666.             :so=:se=:       start/end standout mode (We don't care about :sg#:)
  3667.             :us=:ue=:       start/end underlined mode
  3668.             :md=:me=:       start/end boldface mode
  3669.             :as=:ae=:       start/end alternate character set (italics)
  3670.             :ug#:           visible gap left by :us=:ue=:md=:me=:as=:ae=:
  3671.  
  3672.  
  3673.         Optional fields that affect the cursor's shape
  3674.  
  3675.              The :cQ=: string is used by  Elvis  immediately  before
  3676.         exiting  to  undo  the  effects  of  the  other cursor shape
  3677.         strings.  If :cQ=: is not given, then all other cursor shape
  3678.         strings are ignored.
  3679.  
  3680.             :cQ=:   normal cursor
  3681.             :cX=:   cursor used for reading EX command
  3682.             :cV=:   cursor used for reading VI commands
  3683.             :cI=:   cursor used during VI input mode
  3684.             :cR=:   cursor used during VI replace mode
  3685.  
  3686.  
  3687.              If the capabilities above aren't given, then Elvis will
  3688.         try to use the following values instead.
  3689.  
  3690.             :ve=:   normal cursor, used as :cQ=:cX=:cI=:cR=:
  3691.             :vs=:   gaudy cursor, used as :cV=:
  3692.  
  3693.  
  3694.                            March 23, 1992
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.         10-3                      TERMCAP                       10-3
  3701.  
  3702.  
  3703.  
  3704.  
  3705.         An example
  3706.  
  3707.              Here's the termcap entry I use on my  Minix-ST  system.
  3708.         Some  of  the  fields  in  it have nothing to do with Elvis.
  3709.         Some can only work on my system; I have modified my kernel's
  3710.         screen driver.
  3711.  
  3712.  
  3713.         mx|minix|minixst|ansi:\
  3714.             :is=\E[0~:co#80:li#25:bs:pt:\
  3715.             :cm=\E[%i%d;%dH:up=\E[A:do=^J:nd=\E[C:sr=\EM:\
  3716.             :cd=\E[J:ce=\E[K:cl=\E[H\E[J:\
  3717.             :al=\E[L:dl=\E[M:ic=\E[@:dc=\E[P:im=:ei=:\
  3718.             :so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\
  3719.             :md=\E[1m:me=\E[m:as=\E[1;3m:ae=\E[m:\
  3720.             :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\
  3721.             :k1=\E[1~:k2=\E[2~:k3=\E[3~:k4=\E[4~:k5=\E[5~:\
  3722.             :k6=\E[6~:k7=\E[17~:k8=\E[18~:k9=\E[19~:k0=\E[20~:\
  3723.             :kU=\E[36~:kQ=\E[32~:kH=\E[28~:\
  3724.             :GV=3:GH=D:G1=?:G2=Z:G3=@:G4=Y:GC=E:GL=4:GR=C:GU=A:GD=B:\
  3725.             :cQ=\E[k:cX=\E[2;0k:cV=\E[16;0k:cI=\E[k:cR=\E[16;20k:
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.                                March 23, 1992
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.         11.  ENVIRONMENT VARIABLES
  3770.  
  3771.              Elvis examines several environment  variables  when  it
  3772.         starts  up.   The  values of these variables are used inter-
  3773.         nally for a variety of purposes.  You don't need  to  define
  3774.         all  of  these; on most systems, Elvis only requires TERM to
  3775.         be defined.  On AmigaDOS, MS-DOS or TOS systems,  even  that
  3776.         is optional.
  3777.  
  3778.         TERM, TERMCAP
  3779.  
  3780.              TERM tells Elvis the name of the termcap entry to  use.
  3781.         TERMCAP  may contain either the entire termcap entry, or the
  3782.         full pathname of the termcap file to search through.
  3783.  
  3784.              If your version of Elvis is using tinytcap  instead  of
  3785.         the  full  termcap library, then the value of TERMCAP cannot
  3786.         contain any  backslash  escapes  (\E,  \r,  etc.)  or  carat
  3787.         escapes  (^[, ^M, etc.), because tinytcap doesn't understand
  3788.         them.  Instead, you should embed the actual control  charac-
  3789.         ter into the string.
  3790.  
  3791.         TMP, TEMP
  3792.  
  3793.              These only work for AmigaDOS,  MS-DOS  and  Atari  TOS.
  3794.         Either of these variables may be used to set the "directory"
  3795.         option, which controls where temporary files are stored.  If
  3796.         you define them both, then TMP is used, and TEMP is ignored.
  3797.  
  3798.         LINES, COLUMNS
  3799.  
  3800.              The termcap entry for your terminal should specify  the
  3801.         size of your screen.  If you're using a windowing interface,
  3802.         then there is an ioctl() call which will provide the size of
  3803.         the  window;  the ioctl() values will override the values in
  3804.         the termcap entry.  The LINES and COLUMNS environment  vari-
  3805.         ables  (if  defined)  will override either of these sources.
  3806.         They, in turn, can be overridden by a ":set" command.
  3807.  
  3808.              Normally, the LINES  and  COLUMNS  variables  shouldn't
  3809.         need to be defined.
  3810.  
  3811.         EXINIT
  3812.  
  3813.              This variable's value may contain one  or  more  colon-
  3814.         mode  commands,  which  will  be  executed  after all of the
  3815.         ".exrc" files but before interactive editing begins.
  3816.  
  3817.              To put  more  than  one  command  in  EXINIT,  you  can
  3818.         separate the commands with either a newline or a '|' charac-
  3819.         ter.
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.                                March 23, 1992
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.         11-2               ENVIRONMENT VARIABLES                11-2
  3833.  
  3834.  
  3835.         SHELL, COMSPEC
  3836.  
  3837.              You can use COMSPEC in MS-DOS, or SHELL  in  any  other
  3838.         system,  to specify which shell should be used for executing
  3839.         commands and expanding wildcards.
  3840.  
  3841.         HOME
  3842.  
  3843.              This variable should give the  full  pathname  of  your
  3844.         home  directory.   Elvis needs to know the name of your home
  3845.         directory so it can locate the ".exrc" file there.
  3846.  
  3847.         TAGPATH
  3848.  
  3849.              This variable is used by the "ref"  program.   It  con-
  3850.         tains  a  list  of directories that might contain a relevent
  3851.         "tags" file.  Under AmigaDOS, MS-DOS or Atari TOS, the names
  3852.         of  the directories should be separated by semicolons (";").
  3853.         Under other operating systems, the names should be separated
  3854.         by colons (":").
  3855.  
  3856.              If you don't define TAGPATH,  then  "ref"  will  use  a
  3857.         default  list which includes the current directory and a few
  3858.         other likely places.  See the definition  of  DEFTAGPATH  at
  3859.         the start of ref.c for an accurate list.
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.                                March 23, 1992
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.         12.  VERSIONS
  3902.  
  3903.              Elvis currently works under  BSD  UNIX,  AT&T  System-V
  3904.         UNIX,   SCO  XENIX,  Minix,  Coherent,  MS-DOS,  Atari  TOS,
  3905.         OS9/68k, VAX/VMS, and AmigaDos.  This section of the  manual
  3906.         provides special information that applies to each particular
  3907.         version of Elvis.
  3908.  
  3909.              For all versions except MS-DOS, the file "Makefile.mix"
  3910.         should  be  copied  to "Makefile", and then edited to select
  3911.         the correct set of options for your system.  There  is  more
  3912.         information about this embedded in the file itself.
  3913.  
  3914.         12.1.  BSD UNIX
  3915.  
  3916.              Temporary files are stored in /tmp.
  3917.  
  3918.              You should modify /etc/rc so that the  temp  files  are
  3919.         preserved  when  the  system  is  rebooted.   Find a line in
  3920.         /etc/rc which reads
  3921.              ex4.3preserve /tmp
  3922.  
  3923.              or something like that, and append the  following  line
  3924.         after it:
  3925.              elvprsv /tmp/elv*
  3926.  
  3927.              If you do not have permission to modify /etc/rc,  don't
  3928.         fret.  The above modification is only needed to allow you to
  3929.         recover your changes after a system crash.   You  can  still
  3930.         run  Elvis  without  that  modification,  and  you can still
  3931.         recover your changes when Elvis crashes or when your  dialup
  3932.         modem  looses  the  carrier  signal, or something like that.
  3933.         Only a system crash or power failure could hurt you.
  3934.  
  3935.              Both Elvis and the real Vi read initialization commands
  3936.         from  a  file  called ".exrc", but the commands in that file
  3937.         might work on one but not  the  other.   For  example,  "set
  3938.         keywordprg=man"  will  work  for Elvis, but Vi will complain
  3939.         because it doesn't have a "keywordprg" option.  If the warn-
  3940.         ing  messages annoy you, then you can edit the config.h file
  3941.         to change the name of the  initialization  file  ".exrc"  to
  3942.         something else, such as ".elvisrc".
  3943.  
  3944.              If you use X windows, you may wish to add "-DCS_LATIN1"
  3945.         to  CFLAGS.  This will cause the digraph table and the flip-
  3946.         case option to have default values that are appropriate  for
  3947.         the  LATIN-1  character  set.  That's the standard character
  3948.         set for X.
  3949.  
  3950.              The default keyboard macro time-out value is larger for
  3951.         BSD  than  it  is  for  some other systems, because I've had
  3952.         trouble running Elvis via rlogin or Xterm.  I guess it takes
  3953.         a while for those keystokes to squirt through the net.
  3954.  
  3955.  
  3956.  
  3957.  
  3958.                                March 23, 1992
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.         12-2                      VERSIONS                      12-2
  3965.  
  3966.  
  3967.         12.2.  System-V UNIX
  3968.  
  3969.              Most SysV UNIX systems use terminfo instead of termcap,
  3970.         but  the  terminfo  library  doesn't seem to have a standard
  3971.         name.  As shipped, Elvis' Makefile.mix  is  configured  with
  3972.         "LIBS=-lterm". You may need to change it to "LIBS=-ltermcap"
  3973.         or "LIBS=-lterminfo" or even "LIBS=-lcurses".
  3974.  
  3975.              The /etc/rc file should be modified  as  described  for
  3976.         BSD  systems,  above.  The only difference is that SysV sys-
  3977.         tems tend to have directories for initialization, instead of
  3978.         a  single  large  /etc/rc  file.  Editor recovery is usually
  3979.         done somewhere in the /etc/rc2.d directory.
  3980.  
  3981.              The potential trouble with ".exrc" described above  for
  3982.         BSD UNIX applies to System-V UNIX as well.
  3983.  
  3984.              Elvis uses control-C as the interrupt key, not Delete.
  3985.  
  3986.         12.3.  SCO Xenix
  3987.  
  3988.              For Xenix-386, you can use the  generic  System-V  set-
  3989.         tings.   You may wish to add "-DCS_IBMPC" to CFLAGS, to have
  3990.         the digraph table and flipcase option start  up  in  a  mode
  3991.         that is appropriate for the console.
  3992.  
  3993.         There is a separate group of settings for  use  with  Xenix-
  3994.         286.  It already has "-DCS_IBMPC" in CFLAGS.
  3995.  
  3996.              Because Xenix is so similar to System-V,  everything  I
  3997.         said  earlier  about  System-V  applies to the Xenix version
  3998.         too, except that  editor  recovery  probably  belongs  in  a
  3999.         directory called /etc/rc.d/8.
  4000.  
  4001.         12.4.  Minix
  4002.  
  4003.              There are separate settings in Makefile.mix for  Minix-
  4004.         PC  and  Minix-68k.   The  differences between these two are
  4005.         that the 68k version uses ".o" for the object file extension
  4006.         where  the PC version uses ".s", and the PC version has some
  4007.         extra flags in CFLAGS to reduce the size of Elvis.   The  PC
  4008.         version  also uses tinytcap (instead of the full termcap) to
  4009.         make it smaller.
  4010.  
  4011.              Minix-PC users should read the CFLAGS section  of  this
  4012.         manual very carefully.  You have some choices to make...
  4013.  
  4014.              The  temporary  files  are  stored  in  /usr/tmp.   The
  4015.         /usr/tmp  directory  must exist before you run Elvis, and it
  4016.         must be readable/writable by  everybody.   We  use  /usr/tmp
  4017.         instead  of  /tmp  because  after  a  system  crash or power
  4018.         failure, you can recover the altered version of a file  from
  4019.         the  temporary  file in /usr/tmp.  If it was stored in /tmp,
  4020.         though, then it would  be  lost  because  /tmp  is  normally
  4021.  
  4022.  
  4023.  
  4024.                                March 23, 1992
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.         12-3                      VERSIONS                      12-3
  4031.  
  4032.  
  4033.         located on the RAM disk.
  4034.  
  4035.              Elvis uses control-C as the interrupt key, not Delete.
  4036.  
  4037.         12.5.  Coherent
  4038.  
  4039.              Elvis was ported to Coherent by Esa Ahola.
  4040.  
  4041.              Elvis is too large to run  under  Coherent  unless  you
  4042.         eliminate  some features via the CFLAGS setting.  The recom-
  4043.         mended settings, in Makefile.mix, produce a working  version
  4044.         of Elvis which emulates Vi faithfully, but lacks most of the
  4045.         extensions.  You should read  the  CFLAGS  section  of  this
  4046.         manual carefully.
  4047.  
  4048.              You can probably reduce the  size  of  Elvis  by  using
  4049.         tinytcap.c  instead of -lterm.  This would allow you to keep
  4050.         most features of Elvis, at the expense of terminal  indepen-
  4051.         dence.   (Tinytcap.c  has  ANSI  escape sequences hard-coded
  4052.         into it.) To use tinytcap,  just  add  "tinytcap.o"  to  the
  4053.         "EXTRA="  line in the Makefile, and remove "-lterm" from the
  4054.         "LIBS=" line.
  4055.  
  4056.              The temporary files are stored  in  /tmp.   You  should
  4057.         modify your /etc/rc file as described for BSD earlier.
  4058.  
  4059.         12.6.  MS-DOS
  4060.  
  4061.              Elvis was ported to MS-DOS by Guntram Blohm and  Martin
  4062.         Patzel.  Willett Kempton added support for the DEC Rainbow.
  4063.  
  4064.              Ideally, Elvis should be compiled with Microsoft C 5.10
  4065.         and  the  standard  Microsoft  Make utility, via the command
  4066.         "make elvis.mak".  This will compile Elvis and  all  related
  4067.         utilities.
  4068.  
  4069.              With Microsoft C 6.00, use Makefile.mix  with  "NDMAKE"
  4070.         settings.  You  may  have trouble compiling regexp.c; if so,
  4071.         try compiling it without optimization.
  4072.  
  4073.              The "Makefile.mix" file contains  a  set  of  suggested
  4074.         settings for compiling elvis with Turbo-C or Borland C.  (If
  4075.         you have Turbo-C, but not the Make  utility,  then  you  can
  4076.         almost  use  the  "Elvis.prj" file to compile Elvis, but you
  4077.         must  explicitly  force  Turbo-C  to  compile  it  with  the
  4078.         "medium" memory model.  Most of the related programs [ctags,
  4079.         ref, virec, refont, and wildcard] are only one file long, so
  4080.         you  should  have  no trouble compiling them.) The "alias.c"
  4081.         file is meant to be compiled once into an  executable  named
  4082.         "ex.exe".   You  should  then  copy "ex.exe" to "vi.exe" and
  4083.         "view.exe".
  4084.  
  4085.              Elvis stores its temporary files in C:\tmp.  If this is
  4086.         not  satisfactory,  then  you should edit the CFLAGS line of
  4087.         your Makefile to change  TMPDIR  to  something  else  before
  4088.  
  4089.  
  4090.                                March 23, 1992
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.         12-4                      VERSIONS                      12-4
  4097.  
  4098.  
  4099.         compiling.  You can also control the name of the temp direc-
  4100.         tory via an environment variable named  TMP  or  TEMP.   The
  4101.         directory must exist before you can run Elvis.
  4102.  
  4103.              The TERM environment variable determines how elvis will
  4104.         write  to  the screen.  It can be set to any one of the fol-
  4105.         lowing values:
  4106.  
  4107.                        pcbios    Use BIOS calls on an IBM-PC clone.
  4108.                        rainbow   Use DEC Rainbow interface.
  4109.                        ansi      Use ANSI.SYS driver.
  4110.                        nansi     User faster NANSI.SYS driver.
  4111.  
  4112.  
  4113.              If  the  TERM  variable  isn't  set,  then  elvis  will
  4114.         automatically  select  either  the "rainbow" interface (when
  4115.         run on a Rainbow) or "pcbios" (on an IBM clone).
  4116.  
  4117.              You may prefer to use NANSI.SYS for speed; or  you  may
  4118.         NEED to use ANSI.SYS for a non-clone, such as a lap-top.  If
  4119.         so, you should  install  one  of  these  drivers  by  adding
  4120.         "driver  = nansi.sys" (or whatever) to your CONFIG.SYS file,
  4121.         and then you should define TERM to be "nansi" (or  whatever)
  4122.         by  adding  "set TERM=nansi" to your AUTOEXEC.BAT file.  You
  4123.         must then reboot for these changes to  take  effect.   After
  4124.         that,  Elvis  will  notice  the  "TERM"  setting and use the
  4125.         driver.
  4126.  
  4127.              Since ".exrc" is not a valid DOS filename, the name  of
  4128.         the  initialization  file  has  been  changed to "elvis.rc".
  4129.         Elvis will look for an "elvis.rc" file first  in  your  home
  4130.         directory, and then in the current directory.  Note that you
  4131.         must set an environment variable named "HOME"  to  the  full
  4132.         pathname  of  your home directory, for Elvis to check there;
  4133.         if "HOME" isn't set,  then  Elvis  will  only  look  in  the
  4134.         current  directory.   To set "HOME", you would typically add
  4135.         the following line to your AUTOEXEC.BAT file:
  4136.              set HOME c:\
  4137.  
  4138.              An extra program, called "wildcard", is needed for  MS-
  4139.         DOS.   It  expands  wildcard  characters  in file names.  If
  4140.         Elvis flashes a "Bad command or filename"  message  when  it
  4141.         starts,  then  you've probably lost the WILDCARD.EXE program
  4142.         somehow.
  4143.  
  4144.              Elvis can run under Windows, but  only  in  full-screen
  4145.         mode.   Also,  Windows  uses  an environment variable called
  4146.         TEMP which interferes with elvis' usage  of  TEMP;  to  work
  4147.         around  this,  you  can  simply  set an environment variable
  4148.         named TMP (with no 'E') to  the  name  of  elvis'  temporary
  4149.         directory.   When  TEMP and TMP are both set, Elvis uses TMP
  4150.         and ignored TEMP.
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.                                March 23, 1992
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.         12-5                      VERSIONS                      12-5
  4163.  
  4164.  
  4165.         12.7.  Atari TOS
  4166.  
  4167.              Elvis was ported to Atari TOS by Guntram Blohm and Mar-
  4168.         tin  Patzel.   It is very similar to the MS-DOS version.  It
  4169.         has been tested with the Mark Williams C compiler  and  also
  4170.         GNU-C.
  4171.  
  4172.              The TERM environment variable is ignored; the  ST  port
  4173.         always  assumes  that  TERM=vt52.   The SHELL (not COMSPEC!)
  4174.         variable should be set to the name of a line-oriented shell.
  4175.  
  4176.              A simple shell in included with Elvis.  Its  source  is
  4177.         in "shell.c", and the name of the executable is "shell.ttp".
  4178.         The file "profile.sh" should contain a set  of  instructions
  4179.         to  be  executed when the shell first starts up.  An example
  4180.         of this file is included, but you will almost certainly want
  4181.         to  edit it right away to match your configuration.  (If you
  4182.         already have a command-line shell, then you'll probably want
  4183.         to  continue  using  it.  The shell that comes with Elvis is
  4184.         very limited.)
  4185.  
  4186.              Currently, character attributes cannot be displayed  on
  4187.         the screen.
  4188.  
  4189.              Elvis runs under MiNT (a free  multi-tasking  extension
  4190.         to  TOS)  but  it  can  be a CPU hog because of the way that
  4191.         Elvis reads from the keyboard  with  timeout.   Also,  Elvis
  4192.         doesn't  use  any  of  the special features of MiNT.  I have
  4193.         received a set of patches that optimize Elvis for MiNT,  but
  4194.         they arrived too late to integrate into this release.
  4195.  
  4196.         12.8.  OS9/68k
  4197.  
  4198.              Elvis was ported to OS9/68k by Peter Reinig.
  4199.  
  4200.              The Makefile is currently configured to  install  Elvis
  4201.         and  the  related  programs  in /dd/usr/cmds If this this is
  4202.         unacceptable, then you should change the BIN setting to some
  4203.         other  directory.   Similarly, it expects the source code to
  4204.         reside in /dd/usr/src/elvis; the ODIR  setting  is  used  to
  4205.         control this.
  4206.  
  4207.              Temporary files are stored in  the  /dd/tmp  directory.
  4208.         Your  /dd/startup file may need to be modified to prevent it
  4209.         from deleting Elvis' temporary files; make  /dd/startup  run
  4210.         the elvprsv program before it wipes out /dd/tmp.
  4211.  
  4212.              The program in alias.c is linked repeatedly to  produce
  4213.         the "vi", "view", and "input" aliases for Elvis.  Sadly, the
  4214.         "ex" alias is impossible to implement under OS9 because  the
  4215.         shell has a built-in command by that name.
  4216.  
  4217.              For some  purposes,  you  must  give  `make'  the  "-b"
  4218.         option.  Specifically, you need this for "make -b clean" and
  4219.         "make -b install".
  4220.  
  4221.  
  4222.                                March 23, 1992
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.         12-6                      VERSIONS                      12-6
  4229.  
  4230.  
  4231.  
  4232.  
  4233.         12.9.  VAX/VMS
  4234.  
  4235.              John Campbell ported Elvis to VAX/VMS.
  4236.  
  4237.              A heavily laden VAX can take half an  hour  to  compile
  4238.         elvis.  This is normal.  Don't panic.
  4239.  
  4240.              While running, elvis will  create  temporary  files  in
  4241.         SYS$SCRATCH.   Enter  SHOW  LOGICAL  SYS$SCRATCH to see what
  4242.         actual directory you are using.  Many sites have SYS$SCRATCH
  4243.         equivalenced  to  SYS$LOGIN.  The elvis temporary files look
  4244.         like the following on VMS while elvis is running:
  4245.                ELV_1123A.1;1       ELV_1123A.2;1       SO070202.;1
  4246.  
  4247.              Also, filtering commands (like !!dir and !}fmt)  should
  4248.         work  on  VMS.   This  assumes, however, that you can create
  4249.         temporary mailboxes and that your mailbox  quota  (a  sysgen
  4250.         parameter)  is  at least 256 bytes for a single write to the
  4251.         mailbox.  This is the default  sysgen  parameter,  so  there
  4252.         should be few people who experience filter problems.
  4253.  
  4254.              Additionally, an attempt was made to support the  stan-
  4255.         dard  terminals  on  VMS: "vt52", "vt100", "vt200", "vt300",
  4256.         "vt101", "vt102".  Non-standard terminals could be supported
  4257.         by  setting  your  terminal type to UNKNOWN (by entering SET
  4258.         TERM/UNKNOWN) and  defining  the  logical  name  ELVIS_TERM.
  4259.         Whatever  ELVIS_TERM translates to, however, will have to be
  4260.         included in tinytcap.c.  Note that the upper/lowercase  dis-
  4261.         tinctions are significant, and that DCL will upshift charac-
  4262.         ters that are not quoted strings, so enter DEFINE ELVIS_TERM
  4263.         "hp2621a".   As distributed, it would probably not be a good
  4264.         idea to have more than the standard terminals in  tinytcap.c
  4265.         (else  it  wouldn't  be  tiny, would it?).  Changes here, of
  4266.         course, would require a recompilation to take effect.
  4267.  
  4268.              If you have a version  of  the  "termcap"  library  and
  4269.         database  on  your  system,  then  you  may  wish to replace
  4270.         tinytcap with the real termcap.
  4271.  
  4272.         12.10.  AmigaDOS
  4273.  
  4274.              Mike Rieser and Dale Rahn ported Elvis to AmigaDOS.
  4275.  
  4276.              The port was done using  Manx  Aztec  C  version  5.2b.
  4277.         Elvis  uses about as much space as it can and still be small
  4278.         code and data.  Elvis should also compile under DICE, though
  4279.         there  may  be  a little trouble with signed versus unsigned
  4280.         chars.
  4281.  
  4282.              The port has been done so  the  same  binary  will  run
  4283.         under both versions of AmigaDOS.  Under AmigaDOS 2.04, Elvis
  4284.         supports all the  documented  features.   It  also  uses  an
  4285.  
  4286.  
  4287.  
  4288.                                March 23, 1992
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.         12-7                      VERSIONS                      12-7
  4295.  
  4296.  
  4297.         external program ref to do tag lookup.  So, the accompanying
  4298.         programs: ref and ctags  are  recommended.   Under  AmigaDOS
  4299.         1.2/1.3 Elvis works, buts lacks the more advanced features.
  4300.  
  4301.              For the port to AmigaDOS 2.04, we tried to use as  many
  4302.         Native  AmigaDOS  calls  as  we could.  This should increase
  4303.         Elvis's chances at  being  compiled  with  other  compilers.
  4304.         DICE  seems  to have a different default char type.  You may
  4305.         need to use the UCHAR() macro in tio.c.  To test it, try the
  4306.         :map command; if it looks right, things are cool.
  4307.  
  4308.              For the port to AmigaDOS 1.3, we tried to make sure the
  4309.         program  was  at  least  usable.  Many features are missing,
  4310.         most notably running commands in subshells.  Also,  what  we
  4311.         could  get working, we used Aztec functions to support them,
  4312.         so this part is little more compiler dependent.
  4313.  
  4314.              Aztec is compatible with the SAS  libcall  #pragma.   I
  4315.         personally  prefer  using the includes that come from Commo-
  4316.         dore over the ones supplied with Aztec, but for people  with
  4317.         a straight Aztec installation, I went with the default names
  4318.         for the Aztec pragmas.
  4319.  
  4320.              One include you'll need is <sys/types.h>.  Its a common
  4321.         include when porting software just make yourself one.  Its a
  4322.         two line file that saves a lot of hassle especially  in  the
  4323.         elvis  source.  So, make a directory where your includes are
  4324.         located called `sys' and in a file below that type:
  4325.  
  4326.                 /* sys/types.h */
  4327.                 #include <exec/types.h>
  4328.  
  4329.              When setting environment  variables  (either  local  or
  4330.         global)  for  variables  that specify a directory, make sure
  4331.         the variable ends in `:' or `/'.  This saved from having  to
  4332.         change  much  of the way elvis works.  The default temporary
  4333.         directory (if TEMP and TMP aren't specified) is  "T:".   The
  4334.         default  if  HOME directory (if no HOME environment variable
  4335.         is set) is "S:".
  4336.  
  4337.              To avoid conlict with other uses, Elvis  uses  elvis.rc
  4338.         instead of .exrc or where it looks for macros.
  4339.  
  4340.         12.11.  Other Systems
  4341.  
  4342.              For Sun workstations, use the BSD configuration.   Ear-
  4343.         lier  versions of elvis didn't link correctly due to a quirk
  4344.         in Sun's version of the "make" utility, but this version  of
  4345.         elvis has a work-around for that quirk so you should have no
  4346.         trouble at all.
  4347.  
  4348.              For Linux, use the SysV  settings.   You  can  probably
  4349.         just remove the "-lterm" from the "LIBS= -lterm" line, since
  4350.         linux keeps the termcap functions in the standard C library.
  4351.  
  4352.  
  4353.  
  4354.                                March 23, 1992
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.         12-8                      VERSIONS                      12-8
  4361.  
  4362.  
  4363.              For other UNIXoid systems, I suggest you start with the
  4364.         Minix-68k settings and then grow from that.  Minix is a nice
  4365.         starting point because it is a  clone  of  Version  7  UNIX,
  4366.         which  was  the  last  common  ancestor of BSD UNIX and SysV
  4367.         UNIX.  Any Operating System which claims any  UNIX  compati-
  4368.         bility  what  so  ever will therefore support V7/Minix code.
  4369.         You may need to fiddle with  #include  directives  or  some-
  4370.         thing,  though.   Minix-68k  is a better starting point than
  4371.         Minix-PC because the PC compiler has some severe quirks.
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.                                March 23, 1992
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.         13.  QUESTIONS & ANSWERS
  4430.  
  4431.  
  4432.         1) How can I make elvis run faster under DOS?
  4433.  
  4434.                There are several things you can do.  The first thing
  4435.                to  do is get a good screen driver such as NANSI.SYS.
  4436.                This can speed up screen redrawing by as  much  as  a
  4437.                factor of eight!  The DOS-specific part of section 12
  4438.                tells you how to do this.
  4439.  
  4440.                You might also consider  reducing  the  size  of  the
  4441.                blocks  that  elvis  uses.   You'll need to recompile
  4442.                Elvis to do this.  The default BLKSIZE is  1024  byte
  4443.                for  the  DOS  version of Elvis, which means that for
  4444.                each keystroke that you insert, elvis must  shift  an
  4445.                average of about 500 bytes.  That's a lot to ask from
  4446.                a little old 5MHz 8088.  A BLKSIZE of 512 bytes might
  4447.                be more appropriate.
  4448.  
  4449.                If you're really desperate for more speed, you  might
  4450.                want to make Elvis store its temporary files on a RAM
  4451.                disk.  However, this limits the size of the file  you
  4452.                can  edit,  and it eliminates any chance you may have
  4453.                had to recover your work after  a  power  failure  or
  4454.                system  crash,  but it might be worth it; you decide.
  4455.                To do this, add ":set dir=R:\" (or whatever your  RAM
  4456.                disk's name is) to the elvis.rc file.
  4457.  
  4458.                Next, consider turning off the "sync"  option.   When
  4459.                the  sync  option  is turned on, Elvis will close the
  4460.                temporary file and reopen it after every  change,  in
  4461.                order  to  force  DOS  to update the file's directory
  4462.                entry.  If you put ":set nosync"  into  the  elvis.rc
  4463.                file,  then  elvis  will only close the file when you
  4464.                start editing a different text file, or  when  you're
  4465.                exiting Elvis.  Consequently, there is no chance that
  4466.                you'll be able to recover your changes after a  power
  4467.                failure... so if you're going to this, then you might
  4468.                as well store the temp files on the RAM disk, too.
  4469.  
  4470.  
  4471.         2) Where's the <Esc> key on a DEC keyboard?
  4472.  
  4473.                I don't know.  Maybe the <F11> key?  You could always
  4474.                use ":map!" to make some other key act like the <Esc>
  4475.                key.  If all else fails, use <Control><[>.
  4476.  
  4477.  
  4478.         3) Is there a way to show which keys do what?
  4479.  
  4480.                Yes.  The command ":map" will show what each key does
  4481.                in  command  mode,  and  ":map!" (with an exclamation
  4482.                mark) shows what each key does in input mode.
  4483.  
  4484.  
  4485.  
  4486.                                March 23, 1992
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.         13-2                QUESTIONS & ANSWERS                 13-2
  4493.  
  4494.  
  4495.                The table is divided into three  columns:  the  key's
  4496.                label,  the characters that it sends, and the charac-
  4497.                ters that Elvis pretends you typed.
  4498.  
  4499.  
  4500.         4) How can I make Elvis display long lines like the real vi?
  4501.  
  4502.                You can't yet.  The next version of Elvis  shouldsup-
  4503.                port this, though.
  4504.  
  4505.  
  4506.         5) I can't recover my text  [under  MS-DOS  or  Atari  TOS].
  4507.            According to the directory listing, the temporary file is
  4508.            0 bytes long.  What went wrong?
  4509.  
  4510.                MS-DOS and TOS only update a file's  directory  entry
  4511.                when the file is closed.  If the system crashes while
  4512.                the file is still open, then  the  file's  length  is
  4513.                stored  as  0  bytes.  The ":set sync" option is sup-
  4514.                posed to prevent this; you probably turned it off  in
  4515.                the interest of speed, right?
  4516.  
  4517.                Under MS-DOS [I don't know  about  TOS],  you  should
  4518.                delete   the  empty  temporary  file,  and  then  run
  4519.                CHKDSK/F.  This might find the data that belonged  in
  4520.                the  empty  file,  and  place it in a new file with a
  4521.                name like "000001.CHK" -- something like  that.   You
  4522.                can  then try to extract the text from that temporary
  4523.                file by giving the  command  "elvprsv  -R  000001.chk
  4524.                >goodnews.txt".   If  you're  lucky,  then  your text
  4525.                might be in GOODNEWS.TXT.
  4526.  
  4527.  
  4528.         6) What is the most current version of Elvis?
  4529.  
  4530.                Each version of Elvis that is released to the  public
  4531.                has  a  version  number  of  the  form  "number point
  4532.                number".  As I write this, the most  current  version
  4533.                of elvis is 1.5.
  4534.  
  4535.                The intermediate steps between one  release  and  the
  4536.                next are labeled with the next version number, with a
  4537.                letter  appended.   For  example,   after   1.4   was
  4538.                released,  I started working on 1.5a.  I am currently
  4539.                working on 2.0a.  When Elvis reaches a stable  state,
  4540.                I'll call it 2.0 and release it.
  4541.  
  4542.                Sometimes a beta-test version of elvis will be avail-
  4543.                able  via  anonymous FTP from m2xenix.psg.com, in the
  4544.                directory "pub/elvis/beta".
  4545.  
  4546.  
  4547.         7) I only got executables, but now I want the  source  code.
  4548.            Where can I get it?
  4549.  
  4550.  
  4551.  
  4552.                                March 23, 1992
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.         13-3                QUESTIONS & ANSWERS                 13-3
  4559.  
  4560.  
  4561.                If you have access to the Internet, then  you  should
  4562.                be  able  to fetch it from one of the public archives
  4563.                such  as  plains.nodak.edu.   It  is  accessible  via
  4564.                anonymous   FTP,   or   via  an  email  server  named
  4565.                "archive-server@plains.nodak.edu".  Elvis is  located
  4566.                in the directory "/pub/Minix/all.contrib".
  4567.  
  4568.                I will also offer it to the C Users' Group. They sell
  4569.                C source code for us$8 per diskette (or slightly more
  4570.                outside  North  America).    Their  phone  number  is
  4571.                (913) 841-1631, and their address is:
  4572.  
  4573.                         The C Users' Group
  4574.                         PO Box 3127
  4575.                         Lawrence KS 66046-0127
  4576.  
  4577.         8) Is this shareware, or public domain, or what?
  4578.  
  4579.                It is not public domain; it  is  copyrighted  by  me,
  4580.                Steve  Kirkendall.   However, this particular version
  4581.                is freely redistributable, in either source  form  or
  4582.                executable  form.   (I  would  prefer  that  you give
  4583.                copies away for free, complete with the  full  source
  4584.                code... but I'm not going to force you.)
  4585.  
  4586.                It is not shareware; you aren't expected to  send  me
  4587.                anything.  You can use it without guilt.
  4588.  
  4589.                It is not  "copylefted."  I  hold  a  copyright,  but
  4590.                currently  I have not added any of the usual restric-
  4591.                tions that you would find on copylefted software.  If
  4592.                people  start doing really obnoxious things to Elvis,
  4593.                then I will start adding restrictions  to  subsequent
  4594.                versions,  but  earlier  versions  won't be affected.
  4595.                (So far, everybody has been pretty good about this so
  4596.                no restrictions have been necessary.)
  4597.  
  4598.  
  4599.         9) Can I reuse parts of your source code?
  4600.  
  4601.                Yes.  Please be careful, though, to  make  sure  that
  4602.                the  code  really is mine.  Some of the code was con-
  4603.                tributed by  other  people,  and  I  don't  have  the
  4604.                authority  to  give  you  permission  to use it.  The
  4605.                author's name can be  found  near  the  top  of  each
  4606.                source  file.  If it says "Steve Kirkendall" then you
  4607.                may use  it;  otherwise,  you'd  better  contact  the
  4608.                author first.
  4609.  
  4610.                Please don't remove my name from the source code.  If
  4611.                you  modify  the  source,  please make a note of that
  4612.                fact in a comment near the top of  the  source  code.
  4613.                And, finally, please mention my name in your documen-
  4614.                tation.
  4615.  
  4616.  
  4617.  
  4618.                                March 23, 1992
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.         13-4                QUESTIONS & ANSWERS                 13-4
  4625.  
  4626.  
  4627.         10) Can Elvis work with non-ASCII files?
  4628.  
  4629.                Elvis can't edit binary files because it can't handle
  4630.                the NUL character, and because of line-length limita-
  4631.                tions.  However, it is 8-bit clean so you  should  be
  4632.                able to edit any European extended ASCII file without
  4633.                any surprises.
  4634.  
  4635.                Elvis has also been  modified  to  work  with  16-bit
  4636.                character  sets.  Yongguang Zhang (ygz@cs.purdue.edu)
  4637.                has created a Chinese  version  of  Elvis  that  uses
  4638.                16-bit  characters  and  runs  under  cxterm (Chinese
  4639.                X-term)  on  X-windows   systems.    Junichiro   Itoh
  4640.                (itojun@foretune.co.jp)  has  modified  Elvis to edit
  4641.                Japanese text under MS-DOS.
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.                                March 23, 1992
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.         CTAGS(1)            UNIX Programmer's Manual             CTAGS(1)
  4691.  
  4692.  
  4693.  
  4694.         NAME
  4695.              ctags - Generates "tags" and (optionally) "refs" files
  4696.  
  4697.         SYNOPSIS
  4698.              ctags [-stvra] filesnames...
  4699.  
  4700.         DESCRIPTION
  4701.              ctags generates the "tags" and "refs" files from a group of
  4702.              C source files.  The "tags" file is used by Elvis' ":tag"
  4703.              command, control-] command, and -t option.  The "refs" file
  4704.              is sometimes used by the ref(1) program.
  4705.  
  4706.              Each C source file is scanned for #define statements and
  4707.              global function definitions.  The name of the macro or func-
  4708.              tion becomes the name of a tag.  For each tag, a line is
  4709.              added to the "tags" file which contains:
  4710.                          - the name of the tag
  4711.                          - a tab character
  4712.                          - the name of the file containing the tag
  4713.                          - a tab character
  4714.                          - a way to find the particular line within the file.
  4715.  
  4716.              The filenames list will typically be the names of all C
  4717.              source files in the current directory, like this:
  4718.                   $ ctags -stv *.[ch]
  4719.  
  4720.         OPTIONS
  4721.              -t   Include typedefs.  A tag will be generated for each
  4722.                   user-defined type.  Also tags will be generated for
  4723.                   struct and enum names.  Types are considered to be glo-
  4724.                   bal if they are defined in a header file, and static if
  4725.                   they are defined in a C source file.
  4726.  
  4727.              -v   Include variable declarations.  A tag will be generated
  4728.                   for each variable, except for those that are declared
  4729.                   inside the body of a function.
  4730.  
  4731.              -s   Include static tags.  Ctags will normally put global
  4732.                   tags in the "tags" file, and silently ignore the static
  4733.                   tags.  This flag causes both global and static tags to
  4734.                   be added.  The name of a static tag is generated by
  4735.                   prefixing the name of the declared item with the name
  4736.                   of the file where it is defined, with a colon in
  4737.                   between.  For example, "static foo(){}" in "bar.c"
  4738.                   results in a tag named "bar.c:foo".
  4739.  
  4740.              -r   This causes ctags to generate both "tags" and "refs".
  4741.                   Without -r, it would only generate "tags".
  4742.  
  4743.              -a   Append to "tags", and maybe "refs".  Normally, ctags
  4744.                   overwrites these files each time it is invoked.  This
  4745.                   flag is useful when you have to many files in the
  4746.  
  4747.  
  4748.  
  4749.         Printed 3/23/92                                                 1
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.         CTAGS(1)            UNIX Programmer's Manual             CTAGS(1)
  4757.  
  4758.  
  4759.  
  4760.                   current directory for you to list them on a single
  4761.                   command-line; it allows you to split the arguments
  4762.                   among several invocations.
  4763.  
  4764.         FILES
  4765.              tags A cross-reference that lists each tag name, the name of
  4766.                   the source file that contains it, and a way to locate a
  4767.                   particular line in the source file.
  4768.  
  4769.              refs The "refs" file contains the definitions for each tag
  4770.                   in the "tags" file, and very little else.  This file
  4771.                   can be useful, for example, when licensing restrictions
  4772.                   prevent you from making the source code to the standard
  4773.                   C library readable by everybody, but you still every-
  4774.                   body to know what arguments the library functions need.
  4775.  
  4776.         BUGS
  4777.              ctags is sensitive to indenting and line breaks.  Conse-
  4778.              quently, it might not discover all of the tags in a file
  4779.              that is formatted in an unusual way.
  4780.  
  4781.         SEE ALSO
  4782.              elvis(1), refs(1)
  4783.  
  4784.         AUTHOR
  4785.              Steve Kirkendall
  4786.              kirkenda@cs.pdx.edu
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.         Printed 3/23/92                                                 2
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.         ELVIS(1)            UNIX Programmer's Manual             ELVIS(1)
  4823.  
  4824.  
  4825.  
  4826.         NAME
  4827.              elvis, ex, vi, view, input - The editor
  4828.  
  4829.         SYNOPSIS
  4830.              elvis [flags] [+cmd] [files...]
  4831.  
  4832.         DESCRIPTION
  4833.              Elvis is a text editor which emulates vi/ex.
  4834.  
  4835.              On systems which pass the program name as an argument, such
  4836.              as Unix and Minix, you may also install elvis under the
  4837.              names "ex", "vi", "view", and "input".  These extra names
  4838.              would normally be links to elvis; see the "ln" shell com-
  4839.              mand.
  4840.  
  4841.              When elvis is invoked as "vi", it behaves exactly as though
  4842.              it was invoked as "elvis".  However, if you invoke elvis as
  4843.              "view", then the readonly option is set as though you had
  4844.              given it the "-R" flag.  If you invoke elvis as "ex", then
  4845.              elvis will start up in the colon command mode instead of the
  4846.              visual command mode, as though you had given it the "-e"
  4847.              flag.  If you invoke elvis as "input" or "edit", then elvis
  4848.              will start up in input mode, as though the "-i" flag was
  4849.              given.
  4850.  
  4851.         OPTIONS
  4852.              -r   To the real vi, this flag means that a previous edit
  4853.                   should be recovered.  Elvis, though, has a separate
  4854.                   program, called elvrec(1), for recovering files.  When
  4855.                   you invoke elvis with -r, elvis will tell you to run
  4856.                   elvrec.
  4857.  
  4858.              -R   This sets the "readonly" option, so you won't acciden-
  4859.                   tally overwrite a file.
  4860.  
  4861.              -t tag
  4862.                   This causes elvis to start editing at the given tag.
  4863.  
  4864.              -m [file]
  4865.                   Elvis will search through file for something that looks
  4866.                   like an error message from a compiler.  It will then
  4867.                   begin editing the source file that caused the error,
  4868.                   with the cursor sitting on the line where the error was
  4869.                   detected.  If you don't explicitly name a file, then
  4870.                   "errlist" is assumed.
  4871.  
  4872.              -e   Elvis will start up in colon command mode.
  4873.  
  4874.              -v   Elvis will start up in visual command mode.
  4875.  
  4876.              -i   Elvis will start up in input mode.
  4877.  
  4878.  
  4879.  
  4880.  
  4881.         Printed 3/23/92                                                 1
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.         ELVIS(1)            UNIX Programmer's Manual             ELVIS(1)
  4889.  
  4890.  
  4891.  
  4892.              -w winsize
  4893.                   Sets the "window" option's value to winsize.
  4894.  
  4895.              +command or -c command
  4896.                   If you use the +command parameter, then after the first
  4897.                   file is loaded command is executed as an EX command.  A
  4898.                   typical example would be "elvis +237 foo", which would
  4899.                   cause elvis to start editing foo and then move directly
  4900.                   to line 237.  The "-c command" variant was added for
  4901.                   UNIX SysV compatibility.
  4902.  
  4903.         FILES
  4904.              /tmp/elv*
  4905.                   During editing, elvis stores text in a temporary file.
  4906.                   For UNIX, this file will usually be stored in the /tmp
  4907.                   directory, and the first three characters will be
  4908.                   "elv".  For other systems, the temporary files may be
  4909.                   stored someplace else; see the version-specific section
  4910.                   of the documentation.
  4911.  
  4912.              tags This is the database used by the :tags command and the
  4913.                   -t option.  It is usually created by the ctags(1) pro-
  4914.                   gram.
  4915.  
  4916.              .exrc or elvis.rc
  4917.                   On UNIX-like systems, a file called ".exrc" in your
  4918.                   home directory is executed as a series of ex commands.
  4919.                   A file by the same name may be executed in the current
  4920.                   directory, too.  On non-UNIX systems, ".exrc" is usu-
  4921.                   ally an invalid file name; there, the initialization
  4922.                   file is called "elvis.rc" instead.
  4923.  
  4924.         SEE ALSO
  4925.              ctags(1), ref(1), virec(1)
  4926.  
  4927.              Elvis - A Clone of Vi/Ex, the complete elvis documentation.
  4928.  
  4929.         BUGS
  4930.              There is no LISP support.  Certain other features are miss-
  4931.              ing, too.
  4932.  
  4933.              Auto-indent mode is not quite compatible with the real vi.
  4934.              Among other things, 0^D and ^^D don't do what you might
  4935.              expect.
  4936.  
  4937.              Long lines are displayed differently.  The real vi wraps
  4938.              long lines onto multiple rows of the screen, but elvis
  4939.              scrolls sideways.
  4940.  
  4941.         AUTHOR
  4942.              Steve Kirkendall
  4943.              kirkenda@cs.pdx.edu
  4944.  
  4945.  
  4946.  
  4947.         Printed 3/23/92                                                 2
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.         ELVIS(1)            UNIX Programmer's Manual             ELVIS(1)
  4955.  
  4956.  
  4957.  
  4958.              Many other people have worked to port elvis to various
  4959.              operating systems.  To see who deserves credit, run the
  4960.              :version command from within elvis, or look in the system-
  4961.              specific section of the complete documentation.
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.         Printed 3/23/92                                                 3
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.         ELVPRSV(1)          UNIX Programmer's Manual           ELVPRSV(1)
  5021.  
  5022.  
  5023.  
  5024.         NAME
  5025.              elvprsv - Preserve the the modified version of a file after
  5026.              a crash.
  5027.  
  5028.         SYNOPSIS
  5029.              elvprsv ["-why elvis died"] /tmp/filename...
  5030.              elvprsv -R /tmp/filename...
  5031.  
  5032.         DESCRIPTION
  5033.              elvprsv preserves your edited text after elvis dies.  The
  5034.              text can be recovered later, via the elvprsv program.
  5035.  
  5036.              For UNIX-like systems, you should never need to run this
  5037.              program from the command line.  It is run automatically when
  5038.              elvis is about to die, and it should be run (via /etc/rc)
  5039.              when the computer is booted.  THAT'S ALL!
  5040.  
  5041.              For non-UNIX systems such as MS-DOS, you can either use
  5042.              elvprsv the same way as under UNIX systems (by running it
  5043.              from your AUTOEXEC.BAT file), or you can run it separately
  5044.              with the "-R" flag to recover the files in one step.
  5045.  
  5046.              If you're editing a file when elvis dies (due to a bug, sys-
  5047.              tem crash, power failure, etc.) then elvprsv will preserve
  5048.              the most recent version of your text.  The preserved text is
  5049.              stored in a special directory; it does NOT overwrite your
  5050.              text file automatically.
  5051.  
  5052.              elvprsv will send mail to any user whose work it preserves,
  5053.              if your operating system normally supports mail.
  5054.  
  5055.         FILES
  5056.              /tmp/elv*
  5057.                   The temporary file that elvis was using when it died.
  5058.  
  5059.              /usr/preserve/p*
  5060.                   The text that is preserved by elvprsv.
  5061.  
  5062.              /usr/preserve/Index
  5063.                   A text file which lists the names of all preserved
  5064.                   files, and the names of the /usr/preserve/p* files
  5065.                   which contain their preserved text.
  5066.  
  5067.         BUGS
  5068.              Due to the permissions on the /usr/preserve directory, on
  5069.              UNIX systems elvprsv must be run as superuser.  This is
  5070.              accomplished by making the elvprsv executable be owned by
  5071.              "root" and turning on its "set user id" bit.
  5072.  
  5073.              If you're editing a nameless buffer when elvis dies, then
  5074.              elvprsv will pretend that the file was named "foo".
  5075.  
  5076.  
  5077.  
  5078.  
  5079.         Printed 3/23/92                                                 1
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.         ELVPRSV(1)          UNIX Programmer's Manual           ELVPRSV(1)
  5087.  
  5088.  
  5089.  
  5090.         AUTHOR
  5091.              Steve Kirkendall
  5092.              kirkenda@cs.pdx.edu
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.  
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.         Printed 3/23/92                                                 2
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.         ELVREC(1)           UNIX Programmer's Manual            ELVREC(1)
  5153.  
  5154.  
  5155.  
  5156.         NAME
  5157.              elvrec - Recover the modified version of a file after a
  5158.              crash
  5159.  
  5160.         SYNOPSIS
  5161.              elvrec [preservedfile [newfile]]
  5162.  
  5163.         DESCRIPTION
  5164.              If you're editing a file when elvis dies, the system
  5165.              crashes, or power fails, the most recent version of your
  5166.              text will be preserved.  The preserved text is stored in a
  5167.              special directory; it does NOT overwrite your text file
  5168.              automatically.
  5169.  
  5170.              The elvrec program locates the preserved version of a given
  5171.              file, and writes it over the top of your text file -- or to
  5172.              a new file, if you prefer.  The recovered file will have
  5173.              nearly all of your changes.
  5174.  
  5175.              To see a list of all recoverable files, run elvrec with no
  5176.              arguments.
  5177.  
  5178.         FILES
  5179.              /usr/preserve/p*
  5180.                   The text that was preserved when elvis died.
  5181.  
  5182.              /usr/preserve/Index
  5183.                   A text file which lists the names of all preserved
  5184.                   files, and the names of the /usr/preserve/p* files
  5185.                   which contain their preserved text.
  5186.  
  5187.         BUGS
  5188.              elvrec is very picky about filenames.  You must tell it to
  5189.              recover the file using exactly the same pathname as when you
  5190.              were editing it.  The simplest way to do this is to go into
  5191.              the same directory that you were editing, and invoke elvrec
  5192.              with the same filename as elvis.  If that doesn't work, then
  5193.              try running elvrec with no arguments, to see exactly which
  5194.              pathname it is using for the desired file.
  5195.  
  5196.              Due to the permissions on the /usr/preserve directory, on
  5197.              UNIX systems elvrec must be run as superuser.  This is
  5198.              accomplished by making the elvrec executable be owned by
  5199.              "root" and setting its "set user id" bit.
  5200.  
  5201.              If you're editing a nameless buffer when elvis dies, then
  5202.              elvrec will pretend that the file was named "foo".
  5203.  
  5204.         AUTHOR
  5205.              Steve Kirkendall
  5206.              kirkenda@cs.pdx.edu
  5207.  
  5208.  
  5209.  
  5210.  
  5211.         Printed 3/23/92                                                 1
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.         FMT(1)              UNIX Programmer's Manual               FMT(1)
  5219.  
  5220.  
  5221.  
  5222.         NAME
  5223.              fmt - adjust line-length for paragraphs of text
  5224.  
  5225.         SYNOPSIS
  5226.              fmt [-width] [files]...
  5227.  
  5228.         DESCRIPTION
  5229.              fmt is a simple text formatter.  It inserts or deletes new-
  5230.              lines, as necessary, to make all lines in a paragraph be
  5231.              approximately the same width.  It preserves indentation and
  5232.              word spacing.
  5233.  
  5234.              The default line width is 72 characters.  You can override
  5235.              this with the -width flag.  If you don't name any files on
  5236.              the command line, then fmt will read from stdin.
  5237.  
  5238.              It is typically used from within vi to adjust the line
  5239.              breaks in a single paragraph.  To do this, move the cursor
  5240.              to the top of the paragraph, type "!}fmt", and hit <Return>.
  5241.  
  5242.         AUTHOR
  5243.              Steve Kirkendall
  5244.              kirkenda@cs.pdx.edu
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.         Printed 3/23/92                                                 1
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.         REF(1)              UNIX Programmer's Manual               REF(1)
  5285.  
  5286.  
  5287.  
  5288.         NAME
  5289.              ref - Display a C function header
  5290.  
  5291.         SYNOPSIS
  5292.              ref [-t] [-c class]... [-f file]... tag
  5293.  
  5294.         DESCRIPTION
  5295.              ref quickly locates and displays the header of a function.
  5296.              To do this, ref looks in the "tags" file for the line that
  5297.              describes the function, and then scans the source file for
  5298.              the function.  When it locates the function, it displays an
  5299.              introductory comment (if there is one), the function's
  5300.              declaration, and the declarations of all arguments.
  5301.  
  5302.         SEARCH METHOD
  5303.              ref uses a fairly sophisticated tag look-up algorithm.  If
  5304.              you supply a filename via -f file, then elvis first scans
  5305.              the tags file for a static tag from that file.  This search
  5306.              is limited to the tags file in the current directory.
  5307.  
  5308.              If you supply a classname via -c class, then elvis searches
  5309.              for a tag from that class.  This search is not limited to
  5310.              the current directory; You can supply a list of directories
  5311.              in the environment variable TAGPATH, and ref will search
  5312.              through the "tags" file in each directory until it finds a
  5313.              tag in the desired class.
  5314.  
  5315.              If that fails, ref will then try to look up an ordinary glo-
  5316.              bal tag.  This search checks all of the directories listed
  5317.              in TAGPATH, too.
  5318.  
  5319.              If you've given the -t flag, then ref will simply output the
  5320.              tag line that it found, and then exit.  Without -t, though,
  5321.              ref will search for the tag line.  It will try to open the
  5322.              source file, which should be in the same directory as the
  5323.              tags file where the tag was discovered.  If the source file
  5324.              doesn't exist, or is unreadable, then ref will try to open a
  5325.              file called "refs" in that directory.  Either way, ref will
  5326.              try to locate the tag, and display whatever it finds.
  5327.  
  5328.         INTERACTION WITH ELVIS
  5329.              ref is used by elvis' shift-K command.  If the cursor is
  5330.              located on a word such as "splat", in the file "foo.c", then
  5331.              elvis will invoke ref with the command "ref -f foo.c splat".
  5332.  
  5333.              If elvis has been compiled with the -DEXTERNAL_TAGS flag,
  5334.              then elvis will use ref to scan the tags files.  This is
  5335.              slower than the built-in tag searching, but it allows elvis
  5336.              to access the more sophisticated tag lookup provided by ref.
  5337.              Other than that, external tags should act exactly like
  5338.              internal tags.
  5339.  
  5340.  
  5341.  
  5342.  
  5343.         Printed 3/23/92                                                 1
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.         REF(1)              UNIX Programmer's Manual               REF(1)
  5351.  
  5352.  
  5353.  
  5354.         OPTIONS
  5355.              -t   Output tag info, instead of the function header.
  5356.  
  5357.              -f file
  5358.                   The tag might be a static function in file.  You can
  5359.                   use several -f flags to have ref consider static tags
  5360.                   from more than one file.
  5361.  
  5362.              -c class
  5363.                   The tag might be a member of class class.  You can use
  5364.                   several -c flags to have ref consider tags from more
  5365.                   than one class.
  5366.  
  5367.         FILES
  5368.              tags List of function names and their locations, generated
  5369.                   by ctags.
  5370.  
  5371.              refs Function headers extracted from source files
  5372.                   (optional).
  5373.  
  5374.         ENVIRONMENT
  5375.              TAGPATH
  5376.                   List of directories to be searched.  The elements in
  5377.                   the list are separated by either semicolons (for MS-
  5378.                   DOS, Atari TOS, and AmigaDos), or by colons (every
  5379.                   other operating system).  For each operating system,
  5380.                   ref has a built-in default which is probably adequate.
  5381.  
  5382.         NOTES
  5383.              You might want to generate a "tags" file the directory that
  5384.              contains the source code for standard C library on your sys-
  5385.              tem.  If licensing restrictions prevent you from making the
  5386.              library source readable by everybody, then you can have
  5387.              ctags generate a "refs" file, and make "refs" readable by
  5388.              everybody.
  5389.  
  5390.              If your system doesn't come with the library source code,
  5391.              then perhaps you can produce something workable from the
  5392.              lint libraries.
  5393.  
  5394.         SEE ALSO
  5395.              elvis(1), ctags(1)
  5396.  
  5397.         AUTHOR
  5398.              Steve Kirkendall
  5399.              kirkenda@cs.pdx.edu
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.         Printed 3/23/92                                                 2
  5410.  
  5411.  
  5412.  
  5413.