home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vil70os2.zip / vile.hlp < prev    next >
Text File  |  1997-02-28  |  146KB  |  3,438 lines

  1.  
  2. Getting along with vile                        (version 7.0)
  3. -----------------------                        -------------
  4.  
  5.     Use Ctrl-D and Ctrl-U to scroll through this help information.
  6.  
  7.     Type Ctrl-O to make this the only window on the screen.
  8.     Type Ctrl-K to get rid of this window.
  9.  
  10.     First, to leave vile, use any of the following:
  11.         :q
  12.         :quit
  13.         :exit
  14.         :wq    (writes current buffer before quitting)
  15.         :q!    (quits without writing any changes!)
  16.         Q
  17.         :wwq or ZZ    (will write all changed buffers)
  18.         ^X-^C    (don't know why.  _They_ don't put in ":q" for _us_!
  19.              Actually, if ^C is your interrupt character, this
  20.              won't get you out of vile.)
  21.  
  22.     To get help (probably just this text), use any of:
  23.         :h
  24.         :help
  25.         ^X-h
  26.         ^A-h
  27.  
  28.     The only vile commands described herein are those not present in
  29.     vi, or differing greatly from those in vi.  There is a section at
  30.     the bottom describing other differences between vile and vi.
  31.  
  32.     To get a complete list of all commands, type ":show-commands".  To
  33.     get a list of all commands that contain the string "name", type
  34.     ":apropos name".  These lists will show all command synonyms and
  35.     key sequences that are bound to the same function, along with a
  36.     short description of the command, and whether it is a motion or
  37.     operator command.
  38.  
  39.     To get information on a specific key-binding or function, use the
  40.     "describe-key" or "describe-function" commands.  You will be asked
  41.     for a keystroke or function name, and a short description will be
  42.     shown.
  43.  
  44.     You needn't type full command names -- type a few characters and
  45.     hit TAB to perform command completion.  Hitting a second TAB will
  46.     pop up a window containing the list of possible completions.
  47.  
  48.     If your screen hops around a lot when you scroll, see the "Note on
  49.     Scrolling" section near the bottom of this file.
  50.  
  51. General Remarks
  52. ---------------
  53.  
  54.     vile holds text in "buffers".  Usually, these correspond to a file
  55.     that you are editing, but not always.  For instance, a buffer
  56.     might be used to display this help text, or to hold the output
  57.     of a shell command that you have run.  Buffers have names, and
  58.     these usually match the names of the files they contain.
  59.  
  60.     Buffers are sometimes displayed in windows.  A buffer may be
  61.     displayed in more than one window at the same time.  There is
  62.     no such thing as a hidden window.  All existing windows are on
  63.     the screen.  There may, however, be hidden buffers, which are not
  64.     currently associated with any window.
  65.  
  66.     All yank/delete registers (the default unnamed register, the numbered
  67.     registers ("1-"9) that hold line-deletes, and the named registers
  68.     ("a-"z)) are global to the editor, and not attached to any single
  69.     buffer.  Thus you can delete text in one buffer and put it back in
  70.     another.
  71.  
  72.     Undo operations are attached to a buffer, not a window.  Thus if
  73.     you have two windows to the same buffer, and make a change in one,
  74.     you can undo it in the other.
  75.  
  76.     vile is 8-bit clean, allowing it to be used more easily at non-
  77.     English speaking sites.  See the section on "8-Bit Operation" for
  78.     more information.
  79.  
  80. Command Prefixes
  81. ----------------
  82.  
  83.     To extend the vi command set in vile, two (or three, depending on
  84.     how you count them) command "prefixes" exist.  These keystrokes,
  85.     in combination with another key, can be bound as a pair to execute
  86.     any vile function.  The default values for these prefixes are
  87.                 Key:                    Bound to dummy function:
  88.         ^X     Control-X     cntl_x-prefix
  89.         ^A     Control-A     cntl_a-prefix
  90.         #      poundsign    function-prefix
  91.     If you find any of these keys hard to type, or would prefer that
  92.     they are all control characters (or all non-control), they can
  93.     be changed by binding a new key to the function listed above.  See
  94.     the section on "Key Rebinding" below.  If you do change the values
  95.     of these keys, most of vile's informational displays (the Binding
  96.     List, for instance) will reflect these changes.  This documentation,
  97.     of course, will not change.
  98.  
  99.     (The '#' key is used in vi to give terminal independent access
  100.     to function key bindings.  This is also true in vile -- if something
  101.     is bound to '#2', then it is also probably available with key F2
  102.     on your keyboard.)
  103.  
  104. Buffer manipulation commands:
  105. -----------------------------
  106.  
  107.     vile stores buffers in a sorted list.  Depending on the
  108.     setting of the "autobuffer" mode, this list is either sorted
  109.     in "most-recently-used" order (this is the vile default), or in a
  110.     fixed order dependent on the order of editing (this is how vi
  111.     normally does it, and can be attained by turning "autobuffer"
  112.     off, with "set noautobuffer").
  113.  
  114.     _    Show a list of the first 9 buffers.  Follow this command
  115.         with a digit to select that buffer, or simply repeat it
  116.         ("__") to select the buffer most-recently visited.  In
  117.         autobuffer mode, this is identical to "_1".  If autobuffer
  118.         mode is off, the buffer which will be visited with "__" is
  119.         flagged with a '#' character in the list.  Modified buffers
  120.         are preceded by a '*' in the history list.  There are many
  121.         different ways to get the previous file:
  122.             __
  123.             _1    (autobuffer mode on)
  124.             1_    (    "       "    ")
  125.             :e#
  126.             ^^   (ctrl-^)  (but many keyboards can't produce this)
  127.  
  128.         The buffer number may also precede the '_' command.  This is
  129.         necessary when visiting buffers numbered higher than '9'.  For
  130.         example, one would type "13_" to visit buffer 13 in the list.
  131.  
  132.         [ See the note under "Differences", below, for comments on
  133.         vi's use of '_'.]
  134.  
  135.     :e    Edit a file.  If the file is already in a buffer, that buffer
  136.         will be recalled into the current window.  This occurs as
  137.         follows: If the name given contains no path delimiters
  138.         (i.e. slashes), then it will be compared to the existing
  139.         vile buffer names.  Failing that comparison (or if there
  140.         are any slashes in the name), the name will be stretched
  141.         into an absolute path, and will be compared to the existing
  142.         buffers' filenames.  In either case, the matching buffer
  143.         will be chosen.  If there are no such matches, the file
  144.         will be fetched from the filesystem.  This matching
  145.         technique introduces an ambiguity, since buffer names are
  146.         created from the last path component of filenames.  To
  147.         force vile to edit a file from the current directory whose
  148.         basename matches that of one that was edited elsewhere,
  149.         simply preface the name with "./".  For example, if you
  150.         edit "../Makefile" and later attempt to edit "Makefile",
  151.         vile will assume you are referring to the _buffer_ named
  152.         "Makefile".  To get the file in the current directory,
  153.         specify "./Makefile".
  154.  
  155.     :e!    Re-edit a file.  A different filename can be given, and the
  156.         buffer name will change to match it.  This command is not as
  157.         necessary in vile as it is in vi, since multiple buffers may
  158.         have outstanding unwritten changes.
  159.  
  160.     :n    Go to the next buffer.  "Next" means "least recently used"
  161.         in autobuffer mode.  In noautobuffer mode, "next" means
  162.         next in numeric sequence.  (The ":n file ..." version of
  163.         the command is not supported.)
  164.  
  165.     :rename-buffer   Rename the current buffer.  Prompts for a new name.
  166.         Does not affect the filename associated with the buffer.
  167.         Use ":f" to do that.  This command is useful for renaming
  168.         the "[Output]" buffer, if you wish to preserve its
  169.         contents, but run a new command.
  170.  
  171.     :rewind    Go to the first buffer.  This is used only in 'noautobuffer'
  172.         (vi-style buffering) mode.  It does nothing in "autobuffer"
  173.         mode.  Remember that "autobuffer" mode is the default.
  174.  
  175.     :b    Edit a buffer.  Recalls the named buffer.  Does not look for
  176.         a file of that name.  Will find "invisible" buffers.
  177.  
  178.     :ki    Kill a buffer.  Remove the buffer and its contents from the
  179.         editor.  Will ask if changes to the buffer should be
  180.         discarded.
  181.  
  182.     ^X-e    Edit the file whose pathname appears under the cursor.  For
  183.         example, if you are editing a makefile, you could edit one
  184.         of the source files by placing the cursor at the start of
  185.         its name and using this command.  Note that this does not
  186.         know about some characters that your shell might usually
  187.         translate for you, like the '$' in '$HOME'.
  188.  
  189.     ^X-k    Kill the buffer whose name or filename appears under the
  190.         cursor.
  191.  
  192.     *    Display a list of all buffers, or make that display go away
  193.         if it's already present.  Leave your finger on the key, and
  194.         it's easy to create and destroy the list.  The buffers are
  195.         numbered; the numbers correspond to the history numbers
  196.         shown and used by the '_' command, described above.  (If
  197.         the buffer number is greater than 9, then the "nn_" form of
  198.         the '_' command must be used, since '_' will only accept a
  199.         single following digit.)  The order of the list is either
  200.         most-recently-used, or fixed, depending on the setting
  201.         of "autobuffer" mode (see below).  vile attempts to keep
  202.         the contents of the buffer list window up to date if it
  203.         is left up on the screen while other buffer manipulation
  204.         commands are given.
  205.  
  206.     ^A-*    Always display a list of all buffers.  Useful for updating the
  207.         list if it's already on the screen but may be out of date.
  208.         Any argument will cause the list to include _all_ buffers,
  209.         even those normally considered "invisible".  (For example,
  210.         macros are stored in "invisible" buffers.)  [This command
  211.         isn't as necessary now that the buffer list is maintained
  212.         dynamically...]
  213.  
  214. Window manipulation commands:
  215. -----------------------------
  216.  
  217.     ^X-2    Make Two windows.  Splits the current window in half. This
  218.         is the usual way to create a new window.
  219.     ^K or ^X-0    Get rid of (Kill) this window.
  220.     ^O or ^X-1    Make this the Only window on the screen.
  221.  
  222.     ^X-o    Move to the next window.
  223.     ^X-O    Move to the previous window.
  224.  
  225.     v    Make the current window smaller.
  226.     V    Make the current window larger.
  227.  
  228.     ^A-^D    Scroll the next window down half a screen.
  229.     ^A-^U    Scroll the next window up half a screen.
  230.     ^A-^E    Scroll the next window up one line.
  231.     ^A-^Y    Scroll the next window down one line.
  232.     (The previous four commands are useful when comparing two buffers.
  233.      Mnemonic -- think of them as affecting the "A"lternate window.)
  234.  
  235.     zH zM zL
  236.     zt zm zb
  237.         These are synonyms for vi's 'z+', 'z.', and 'z-', which
  238.         position the line holding the cursor at the top, middle, or
  239.         bottom of the screen, respectively.  (Any of the second
  240.         characters can be upper or lower case.)  Mnemonically, these
  241.         correspond to the H, M, and L screen positioning commands,
  242.         or to "top", "middle", or "bottom" -- take your choice.
  243.         In a macro, only the first character of the argument is
  244.         significant, but something like "position-window middle" is
  245.         most readable.  Supplying a count will offset that far
  246.         from the top or bottom of window.  (But the middle is
  247.         always the middle.)
  248.  
  249.     ^X-^R    Scroll the window right or left by 1/3 of a screen, or by the
  250.     ^X-^L    number of columns specified.  Changes the "sideways" value.
  251.         Neither of these commands will actually move the cursor
  252.         in the buffer -- they only reframe your view into the buffer.
  253.         If the cursor would be forced to move off-screen (which is
  254.         of course impossible and undesirable) as a result of the
  255.         requested sideways scroll, then nothing at all will happen.
  256.         The commands are arguably crippled as is.
  257.  
  258.     If for some reason you can't get your screen set right via a
  259.     TERM variable, try the ":screen-rows" or ":screen-columns"
  260.     commands (which take their args (number of rows or columns
  261.     respectively) before you type the ":").
  262.  
  263.     [ Personally, I put the following bindings in my .vilerc:
  264.         bind-key split-current-window ^T    ; split into 'T'wo windows
  265.         bind-key next-window ^N        ; 'N'ext window
  266.         bind-key previous-window ^P        ; 'P'revious window
  267.     Since ^K already 'K'ills a window, and ^O makes it the 'O'nly window,
  268.     these give more mnemonic, and faster, access to multiple windows.
  269.     (These would be the default, but ^N, ^P, and ^T have other meanings
  270.     in real vi (all of which have alternate bindings in vile.) ]
  271.  
  272. File manipulation commands:
  273. ---------------------------
  274.  
  275.     The usual ":e", ":r", ":f", ":w" commands are available, though
  276.     only ":e!" and ":w!" are available of the "!" options.  The ":r"
  277.     command reads the named file in after the current line.  To read a
  278.     file before the first line, use ":0r".  File completion works like
  279.     command completion: using the TAB and '?' keys you can complete or
  280.     see next character choices.
  281.  
  282.     The commands ":ww" and ":wwq" correspond roughly to ":w" and ":wq",
  283.     but they each write all modified buffers, rather than just the
  284.     current one.  Giving any numeric argument to ":ww" (i.e. "1:ww")
  285.     will suppress the per-file and "Press return to continue" message.
  286.     This may be useful when using the command from within a macro.
  287.  
  288.     As in vi, ranges of lines specified by line numbers (including '.',
  289.     '$', and '%' shorthands) or marks may precede these commands.
  290.     Unlike vi, search patterns cannot be used as line specifiers.
  291.  
  292.     In addition, two non-"colon" commands have been added:
  293.  
  294.     ^R    Prompts for a filename, and then reads it in _above_ the
  295.         current line.  If a register is specified (e.g. "a^R ),
  296.         the file is read into that named register, but not inserted
  297.         into the current buffer.
  298.  
  299.     ^W    is a writing operator, which prompts for a filename, and
  300.         writes the specified region to that file.  Like all operators,
  301.         if the command is repeated, as in ^W^W, then lines are
  302.         affected.  Use 10^W^W to write 10 lines.
  303.  
  304.         If a register is specified (e.g. "a^W ) then the command
  305.         is _not_ an operator, but writes the specified register to
  306.         the named file.
  307.  
  308. Shell Access
  309. ------------
  310.  
  311.     Anywhere a filename is valid, a command name is also
  312.     valid, entered in the form "!shell-command".  The whole line is
  313.     handed to the shell, and the read or write operation is done on
  314.     the commands standard input or output, as appropriate.  Thus
  315.     you can type ":e !date" to edit a copy of today's date.
  316.  
  317.     The ": !cmd" shell escape works pretty much as it does in vi.
  318.     The command ":!!" will rerun the previous such shell command.
  319.  
  320.     The '!' operator works as a filter, as expected.
  321.  
  322.     In addition, the ^X-! command runs a shell command and captures
  323.     its output in a specific buffer, called "[Output]".  This is
  324.     almost identical to ":e !cmd", except that in that case the buffer
  325.     is named according to the command name.
  326.  
  327.     These "output capture" commands are most useful in conjunction with
  328.     the "error finder", '^X-^X', described below.
  329.  
  330.     Filename completion is performed on words of the shell command
  331.     in response to a TAB character.  To actually include a TAB character
  332.     in the shell command, escape it with ^V.  Command completion is
  333.     not currently implemented -- so, for instance, $PATH is not searched
  334.     for possible completions to the first word of a command line.
  335.  
  336.     On systems supporting job control, ^Z (or ":stop") will suspend vile.
  337.  
  338.     The :cd and :pwd commands are of course supported.  Unlike vi,
  339.     filenames will track their directory of origin, so you can't simply
  340.     edit a file in one directory, cd to another, and write it.  You
  341.     must explicitly write to ./filename in the new directory to
  342.     accomplish this.  ":cd -" will return to the previous directory, as
  343.     it does in some shells.  The CDPATH environment variable provides a
  344.     search path for the :cd command.
  345.  
  346.     Giving an argument to the ": !" (also called "shell-command" when
  347.     writing macros) will suppress the "Press return to continue" message
  348.     after the command runs.
  349.  
  350. Text manipulation command:
  351. --------------------------
  352.  
  353.     Remember, these are only the new or different commands.  The
  354.     standard vi set should still work.
  355.  
  356.     The vi "global" (":g") command is present.  So is the "substitute"
  357.     (":s") command.  These both look pretty different while they're
  358.     being used than they do in vi, due to the interactive nature of
  359.     the prompting.  And, since the searching is done right after the
  360.     pattern is entered, there may be a slight delay while you're trying
  361.     to finish typing your complete command.  (If the pattern does not
  362.     exist, you may not get to finish typing your command at all.)  You
  363.     can use the commands just as you would have in vi, i.e.
  364.     ":g/oldpat/s//newstring/" will work.  But you won't see any of the
  365.     '/' characters.  Try it-- you'll get the idea.  Line ranges are not
  366.     possible on ":g", but they are on ":s".
  367.  
  368.     The ":g" command can be followed by any of l (list), p (print),
  369.     < (left shift), > (right shift), r (read file), d (delete),
  370.     L (lower case), U (upper case), ~ (flip case), put (append
  371.     yanked text), Put (prepend yanked text), s (substitute),
  372.     trim (trim trailing whitespace).  For example, ":g/pattern/Put"
  373.     will insert the contents of the default yank register just
  374.     above every line containing "pattern".   The ":g" command can
  375.     only be used over the entire file -- smaller regions are not
  376.     permitted.
  377.  
  378.     The ":v" counterpart to ":g" is also implemented -- it performs the
  379.     given command on all lines that don't match the given pattern.
  380.  
  381.     The substitute command can be followed by any of 'g', a digit, or
  382.     'p', to do the substitution for all occurrences, the n'th
  383.     occurrence, or to print the resulting line respectively.  You can
  384.     also add a 'c', and you will be asked to confirm each replacement
  385.     before it occurs.  The text being replaced will be highlighted,
  386.     and you can answer with 'y', 'n', 'q', or 'a'.  'a' will suppress
  387.     further prompting, and will do the rest of the replacements.
  388.  
  389.     The ":&" and '&' commands work much as they do in vi, and repeat
  390.     the last substitution.  The '^A-&' command is a new operator (see
  391.     below), so it can work on regions: for example use '^A-&}' to
  392.     "repeat the previous substitution over the rest of this paragraph".
  393.  
  394.     Infinite Undo
  395.     --------------
  396.     The regular undo ('u') and line-undo ('U') are available for all
  397.     commands.  They are a little more predictable than their vi
  398.     counterparts, since they do not share the default yank register for
  399.     their operation.  Also, line-undo ('U') is available until the next
  400.     change anywhere in the file, rather than until you leave the line.
  401.  
  402.     vile also lets you undo all changes made to a buffer since it was
  403.     first edited (so-called "infinite undo").  The '^X-u' command will
  404.     undo changes, one by one (or given a count, several at a time).
  405.     The '^X-r' command will walk forward, redoing the previously undone
  406.     changes one by one.  A fresh change to the buffer will cause
  407.     previously undone changes to no longer be redoable.  Remember that
  408.     with key rebinding, you can change your 'u' or 'U' command to be an
  409.     infinite undo, making it easier to type.
  410.  
  411.     In addition, the '.' command, which normally re-executes the last
  412.     buffer-modifying command, has special behavior with respect to
  413.     undo.  If the '.' command immediately follows one of the undo
  414.     commands ('u', '^X-u', or '^X-r'), then it will perform another
  415.     undo or redo, as appropriate.  If there are any intervening commands,
  416.     then '.' will re-execute the last command prior to the undo.  [ This
  417.     modification to the behavior of "u." does not conflict (much) with
  418.     traditional use of '.', since by definition, the sequence "u." is
  419.     (almost) always identical to "uu", and the latter is more easily
  420.     typed.  (Credit goes to the designers of "nvi" for this trick.)
  421.     (BTW, the one case i know of where "u." is not identical to "uu" is
  422.     when putting back the contents of the numbered registers:  the
  423.     sequence "1pu.u.u.u. would successively insert the contents of "1,
  424.     "2, "3, "4, and "5, allowing you to choose the "correct" register.
  425.     This sequence no longer works.  You can still put them _all_ back
  426.     with "1p..... and then delete the ones you _don't_ want. ]
  427.  
  428.     The number of changes stored in the undo "history" is controlled by
  429.     the numeric mode "undolimit".  The default history length is 10 --
  430.     that is, only 10 changes may be undone.  Set the undolimit to 0 for
  431.     truly infinite undo.  This can consume a lot of memory.
  432.  
  433.     The cursor position after an undo may not always be the same as it
  434.     would be in vi.
  435.  
  436.     Operators
  437.     ---------
  438.     vi has a class of commands known as "operators".  Operator commands
  439.     are always immediately followed by a motion command.  The region of
  440.     text affected by an operator is bounded on one end by the initial
  441.     position of the cursor, and on the other by the cursor position
  442.     after the motion is completed.  Thus the delete operator ('d') can
  443.     be followed by the word motion command ('w'), causing the next word
  444.     to be deleted.  The sequence "dG" will delete from the cursor
  445.     through the end of the file, and "d/junk" will delete to the next
  446.     occurrence of the string "junk".  As a special "honorary" type of
  447.     motion, operators can all be "stuttered" to affect lines.  Thus
  448.     "dd" deletes one line, "4dd" affects 4 lines, etc.
  449.  
  450.     Most operators affect the region exactly, but some cause only whole
  451.     lines to be affected.  This is usually a function of what sort of
  452.     motion follows the operator, but can sometimes be affected by the
  453.     operator itself.  The best example of motions having different
  454.     effects is the 'goto-mark' motions, the ''' and '`' commands.  If a
  455.     mark is set, say mark 'a', with the 'ma' command, then if the
  456.     command d`a is executed, the exact text between the cursor and the
  457.     mark will be deleted.  If, on the other hand, the d'a command is
  458.     used, the deleted region will include the lines containing the
  459.     cursor and the mark in their entirety.
  460.  
  461.     Some operators in vile can be "forced" to affect regions of whole
  462.     lines, though the motion wouldn't normally imply it, by using the
  463.     '^X' form of the command.  (It's not really forced -- it's really
  464.     a separate operator.)  For example, "d%" (assuming you are on a
  465.     curly brace) will delete a C-style block of code.  "^X-d%" will
  466.     delete that same area, plus anything else on the lines containing
  467.     the curly-brace endpoints.
  468.  
  469.     Note that some operators always affect whole lines, no matter
  470.     how the motion is specified.  The '!' operator is an example:
  471.     "!w" will always filter an entire line, and not just a single word.
  472.  
  473.     vile extends this notion of the "shape" of a region by adding
  474.     the concept of rectangular regions, whose boundaries are
  475.     delimited by the rectangle whose opposite corners are at the
  476.     cursor and at the other end of the motion, respectively.  See
  477.     the section "Rectangular regions" below.
  478.  
  479.     The "show-operators" command will show all available operators.
  480.     The "show-motions" command will show all available motions.
  481.     Any operator may be followed by any motion.
  482.  
  483.     There are several new operator commands in vile:
  484.  
  485.     ^A-~    Is the operator form of the '~' command, so "^A-~~"
  486.         changes the case of all characters on the current
  487.         line, "^A-~w" does it to a word, "3^A-~}" does it for
  488.         3 paragraphs, etc.  (In vile, the simple '~' command
  489.         will take a repeat count, unlike some versions of vi.
  490.         If you wish it to be an operator, rebind '~' to the
  491.         "flip-til" command.)
  492.     ^A-u    Like ^A-~, but converts the region to upper case.
  493.     ^A-l    Like ^A-~, but converts the region to lower case.
  494.  
  495.     ^A-f    Format the region based on the current fill column.  The
  496.         initial indentation of both the first and second lines of
  497.         each "paragraph" in the region are preserved, and all
  498.         subsequent lines get the second line's indentation.  This
  499.         makes indented/outdented paragraphs (like this one) work
  500.         correctly.  (This is intentionally _not_ the same behavior
  501.         obtained by using "!fmt", since that behavior is obviously
  502.         available elsewhere.)  The usual usage of this command is
  503.         "^A-f}", which reformats the current paragraph.  The
  504.         re-formatting begins again with each new paragraph, where a
  505.         paragraph has the same boundaries used by the '{' and '}'
  506.         commands -- i.e. blank lines, or lines beginning in .I .L
  507.         .P .Q or .b.  This makes it possible to use "3^A-f}" or
  508.         "^A-fG" to reformat multiple paragraphs.  The reformatting
  509.         operation knows a little about both C and shell comments,
  510.         and will attempt to do the "right" thing with lines that
  511.         start with '#' or '*' characters.  (It also knows about the
  512.         '>' character, making it fairly easy to reformat mail and
  513.         news inclusions...  but is it ethical?  :-)
  514.  
  515.     ^X-s    For every occurrence of a search string, put in a replace-
  516.         ment string.  This is similar to "s/pattern/replacement/g"
  517.         over the region.
  518.  
  519.     ^A-&    Is an operator in vile, similar to the traditional & command.
  520.         It repeats the last substitution over the specified region.
  521.         (Unlike the '&' command, this one will remember trailing
  522.         g, p, l, or numeric options.)
  523.  
  524.     ^X-d    Delete the region, including the lines it starts and ends on.
  525.     ^X-c    Change the region, including the lines it starts and ends on.
  526.     ^X-y    Yank the region, including the lines it starts and ends on.
  527.  
  528.     ^A-t    Trim trailing whitespace from all lines in the region.
  529.  
  530.     ^A-<SPACE> Convert tabs to spaces, using the current tabstop value.
  531.     ^A-<TAB>   Convert as many spaces to tabs as appropriate.
  532.  
  533.     ^A-b    Blank out a region.  Turns the region to whitespace.  Useful
  534.         with rectangular regions.
  535.     ^A-r    Open up a rectangle.  Text to the right of the left edge
  536.         of the rectangular region will shift to the right by the
  537.         width of the rectangle, leaving a whitespace "hole".
  538.     ^A-q    Sweep out a rectangle with multiple motion commands.  See
  539.         description of 'q', below.
  540.  
  541.     ^A-s    Select and yank a region.  The region will be highlighted
  542.         on the screen, as if it had been swept by a mouse.  It
  543.         is also yanked, as with the 'y' operator.  This operator
  544.         is useful in combination with the ^S motion command, which
  545.         lets one reference the selected region with other operators.
  546.         (If you use this command much, it is recommended that you
  547.         bind it to and easier to type sequence, such as 'S'.)
  548.  
  549.     Text insertion
  550.     --------------
  551.     ^X-p    Causes the previously yanked or deleted text, no matter
  552.         how it was obtained, to be inserted after the current line.
  553.         Usually text that did not consist of whole lines where it
  554.         came from is inserted immediately following the cursor.
  555.     ^X-P    As above, but the text is put before the current line.
  556.         Thus "dw" followed by a "p" command does a normal insertion
  557.         of the deleted word, whereas "^X-p" results in the word
  558.         being inserted on a line by itself.
  559.  
  560.     R    vi's overwrite mode is supported.  Note that the combination
  561.         of overwrite mode and the (ANSI) arrow keys can be used to
  562.         give a "picture drawing" mode of operation: anything you
  563.         type goes into the buffer without moving adjacent text, and
  564.         you can move around using the arrow keys without leaving
  565.         overwrite mode.  Hint: start with a buffer full of lines
  566.         that consist entirely of blanks (as opposed to blank
  567.         lines).
  568.  
  569.     ^A-i    Like their 'i', 'o', and 'O' counterparts, but any autoindent
  570.     ^A-o    or cmode setting is ignored for the duration of this insert.
  571.     ^A-O    These are most useful when pre-formatted text is being
  572.         pasted, as when using a mouse.
  573.  
  574.     Searching
  575.     ---------
  576.     ^X-/    Does a forward search for the "word" located under the
  577.         cursor.
  578.     ^X-?    Does a reverse search for the "word" located under the
  579.         cursor.
  580.     ^A-/    Does not do a search, but sets the search pattern to the
  581.         "word" under the cursor.  Useful for "picking up" a word
  582.         from one buffer, and searching for it in another.
  583.  
  584.     The following two commands may not always be present in vile,
  585.         depending on how it was built:
  586.     ^X-S    Incremental forward searching.  As you enter the search
  587.         string, the cursor is advanced to the next match with
  588.         what you've typed so far.  Use ^F and ^R to continue the
  589.         search forward or in reverse, using the current pattern.
  590.     ^X-R    As above, but in reverse.
  591.  
  592.     Tags
  593.     ----
  594.     vile supports vi-style "tags" files.
  595.  
  596.     ":ta" or ":tag" allows you to enter a tagname to locate.  Changes
  597.         to that file and location.
  598.     ^]    Uses the identifier currently under the cursor as the
  599.         tagname.
  600.     ^T or ^X-^] or ":pop" - pops to the file and location just previous
  601.         to the last tag command.
  602.     ^A-^] or ":next-tag" continues searching through the tags file(s)
  603.         for additional matches.
  604.  
  605.     When one of these commands is used, vile will (by default) look for
  606.     a file named "tags" in the current directory, and load it into a
  607.     hidden buffer for use during tag searches.  This buffer is editable
  608.     if you wish (":e tags"), but will not appear in the buffer lists.
  609.     If a buffer named "[Tags 1]" is already available when a tag is
  610.     first requested, it will be used instead of a file found by
  611.     searching the tags setting, and of course will remain visible.
  612.  
  613.     The name of the default tags file may be changed with "set tags"
  614.     (see "tags" under "Editor modes", below).  If multiple filenames
  615.     are given in the "tags" setting (separated by whitespace), they are
  616.     searched in order, and placed in buffers named "[Tags 1]", "[Tags 2]",
  617.     "[Tags 3]", etc.
  618.  
  619.     Tags searched for using '^]' will always be matched exactly.
  620.     If the ":ta" form of the command is used, tag matches will be
  621.     exact unless the mode "taglength" is set non-zero, in which case
  622.     the first tag matching that many characters will be used.
  623.  
  624.     Filenames referred to in tags files are expanded, so environment
  625.     variables and shell special characters like ~ may be used.
  626.  
  627.     The stack of buffer locations waiting to be "popped" to with the
  628.     '^T' (or '^X-^]' or ":pop") command may be viewed with the
  629.     "show-tagstack" command.  The "[Tag Stack]" buffer is animated --
  630.     it will dynamically keep track of current tag references.
  631.  
  632.     Limitations:  In a real vi-style tags file, there are three tab
  633.         separated fields.  The first contains the tagname.  The second
  634.         contains the (relative or absolute) filename.  Everything after
  635.         the second tab is an arbitrary ex-mode command.  vile is not
  636.         quite so flexible as regular vi, and only supports a couple of
  637.         commands in that last "field".  It can be a line number, in
  638.         which case the tag is an absolute index into the file.  Or, it
  639.         can be a search command.  If it begins with a '/', the search
  640.         goes forward.  If it begins with a '?', the search goes
  641.         backward.  In either case, the matching delimiter _must_ be the
  642.         last character on the line in the tags file.
  643.  
  644.         All of this isn't as bad as it sounds, since ctags, the program
  645.         most people use to generate tags files, does generate exactly
  646.         this format.  (Surprise, surprise.)  However, if you attempt
  647.         to create your own tags files, or have other tools that do so,
  648.         you should be aware of these limitations.
  649.  
  650. Miscellaneous commands
  651. ----------------------
  652.  
  653.     ^A-d    Remove blank lines ("deblank").  If the cursor is on a blank
  654.         line, then it and any blank lines surrounding it will be
  655.         removed.  If a non-blank line, then any immediately following
  656.         blank lines will be removed.  If given an argument, will force
  657.         exactly that many blank lines to exist at that point,
  658.         regardless of how many were there before.  Moves current
  659.         location forward, to allow repeated use.
  660.  
  661.     ^X-^X    The "error finder".  Goes to the next file/line error pair
  662.         specified in the last buffer captured from a command's
  663.         output.  This buffer is usually created with the ^X-!
  664.         command.  For example, "^X-!cc -c junk.c" puts all of the
  665.         compiler output into the buffer named "[Output]".
  666.         Repeatedly hitting ^X-^X will position the editor at each
  667.         error in turn, and will eventually start over again at the
  668.         top.  The buffer searched for "errors" will be the last
  669.         shell command run, or the buffer named with the "error-
  670.         buffer" command.  The "Entering directory XXX" and "Leaving
  671.         directory XXX" messages that GNU make puts out with the -w
  672.         switch are honored, so that files are found with the
  673.         correct path.  (Tip: I use the following macro to quickly
  674.         grep a source directory for the string under the cursor:
  675.             use-register g load-register "^X!egrep -n : *.[chs]^M"
  676.         where the ^X and ^M are each single control characters,
  677.         entered using ^V to escape them.  Then I invoke with @g to
  678.         execute. [NB: this macro won't work with DOS versions of
  679.         vile, since ':' doesn't expand to the word under the cursor
  680.         in those versions, since it conflicts with the driver letter
  681.         separator.)
  682.  
  683.         The command parsing is done with regular expressions.  vile
  684.         compiles these from the buffer [Error Expressions], which are a
  685.         set of regular expressions with extra embedded information.
  686.         Unescaped '%' followed by 'V', 'F', 'L', 'C' or 'T' substitute
  687.         verb (Entering/Leaving for gmake), file, line, column and text
  688.         fields.  The V, F, T substitutions are for nonblank fields,
  689.         which is not always enough, so vile additionally recognizes a
  690.         range in brackets, e.g.,
  691.  
  692.             ^%[^:     ]:\s*%L:%T
  693.  
  694.         is compiled as
  695.  
  696.             ^\([^:     ]\+\):\s*\([0-9]\+\):\(.\+\)
  697.  
  698.     ^X-t Set or report on the tab-stop width.  To set, the spacing must
  699.         precede the command, as in "4^X-t".  The "set tabstop"
  700.         command described below does the same thing.  The status
  701.         output indicates whether the buffer is currently using the
  702.         local or global copy of the tabstop value.
  703.  
  704.     ^X-f Set the local fill-column to be used with ^A-f and auto-wrap
  705.         mode on insert.  The default value is 7/8's of the screen
  706.         size, with a maximum of 70.  Since arguments come before
  707.         commands, you type: 65^X-f.  The "set fillcol" command does
  708.         the same thing.  The status output indicates whether the
  709.         buffer is currently using the local or global copy of the
  710.         tabstop value.
  711.  
  712.     ^X-X    Set encryption key.  (not well tested, but hopefully not
  713.         broken)  OPT_ENCRYPT must have been on when vile was built
  714.         for this to do anything.
  715.  
  716.     K    Count prefix.  The first time you type it, it is equivalent
  717.         to an argument of 4 to the following command.  If you repeat
  718.         it, it becomes worth 16, the next time 64, etc...
  719.  
  720.     %    In addition to finding matching braces, brackets, and
  721.         parentheses, the '%' command will find matching #if's,
  722.         #ifdef's and C-style comments.  If the cursor is on the #
  723.         of "#ifdef"/"#if", the '%' command will find the matching
  724.         "#endif" or "#else".  On an "#else" it will find "#endif",
  725.         and on "#endif" it will go back up to the "#ifdef"/"#if".
  726.         If the cursor is on any part of a "/*" or "*/" sequence, it
  727.         will find the appropriate corresponding C comment endpoint.
  728.  
  729.     \    Identical to the ` motion, in that the cursor moves to
  730.         the specified mark (i.e. \a moves to mark 'a').  When
  731.         used with an operator command, the resulting region is
  732.         rectangular instead of "exact".  This is similar to
  733.         the ' motion, which also goes to [the line holding] the
  734.         mark, and causes regions to become "full line" regions.
  735.  
  736.     q    A "quoted motion" command.  After entering 'q', more motion
  737.         commands are accepted until another 'q' is entered.  The
  738.         result of the motion is the cumulative effect of all the
  739.         entered motions.  Thus, one might type:
  740.             dq<arrow><arrow><arrow>...<arrow>q
  741.         to delete all of the text between the starting point
  742.         and the final cursor position.
  743.  
  744.         Any motion command can appear in between the two 'q'
  745.         commands.  If used alone, i.e. not in an operator
  746.         context, then the spanned text is selected, highlighted,
  747.         and yanked as a side effect.  The resulting selection can
  748.         then be manipulated with the ^S pseudo-motion, below.
  749.  
  750.         Most motions will select up to but not including their
  751.         endpoint.  The 'e', 'E', 'f', 't', and '%' commands are
  752.         exceptions to this.  If used in an operator context the
  753.         cursor position may sometimes appear incorrect.  This
  754.         is because operators sometimes change the cursor location
  755.         internally to force the motion to do the "right" thing,
  756.         and the 'q' command makes these internal "fudge factors"
  757.         visible.  An example of this is "dq%q" which does the
  758.         right thing (assuming the cursor is on a '(' to start)
  759.         but which looks wrong, since the cursor will overshoot
  760.         the ')' before the second 'q' is typed.
  761.  
  762.         If a mouse is available, whether in an xterm via the
  763.         "xterm-mouse" setting, or in xvile, then button 1 can be
  764.         clicked to do the extensions, since it, too, is a motion
  765.         command.  (Of course in xvile, it is easier to simply
  766.         "click and drag" -- the 'q' command isn't really necessary
  767.         at all.
  768.  
  769.         Use the repeat-count to specify types of selection: exact=1
  770.         (default), full-line=2, rectangle=3.
  771.  
  772.     ^A-q    As above, but the motions will sweep out rectangular regions.
  773.  
  774.     ^S    A motion, or "pseudo-motion" command.  If a region of
  775.         text has been previously selected, either with the mouse
  776.         (if available) or with the keyboard selection operator
  777.         (^A-s) it can be referenced by any other operator by
  778.         applying that operator to the ^S motion.  As an example,
  779.         suppose a word is selected with the mouse, or with ^A-sw.
  780.         Then, from anywhere in that buffer, one can use d^S to
  781.         delete that word.  ^S used by itself will move the cursor
  782.         to the start of the selected region.  ^S applied to
  783.         the selection operator (^A-s) will extend the current
  784.         selection to include the current location of the cursor.
  785.  
  786.         ^S makes it possible to select any region (including
  787.         rectangular regions) of text with a mouse, and then apply
  788.         any vi operator to that region.
  789.  
  790.     =    If "visual-matches" is set, then vile will highlight all
  791.         occurrences of a pattern that is searched for with one of
  792.         the usual searching commands.  The '=' command will clear
  793.         this highlighting, until the next search for a different
  794.         pattern.
  795.  
  796.  
  797.     vile can display more of its internal "state" than traditional vi.
  798.     Portions of the internal "state" may be viewed using various
  799.     "show-xxx" commands:
  800.  
  801.     show-abbreviations -- displays list of shortcuts defined with the
  802.         ":abbr" command.  (synonymous with ":abbr<CR>")
  803.  
  804.     show-buffers -- displays the current list of available buffers.  Given
  805.         any numeric argument, will list _all_ buffers, even those
  806.         normally invisible or considered temporary.
  807.  
  808.     show-commands or show-bindings -- displays the list of commands
  809.         and the keys bound to them.
  810.  
  811.     show-global-modes, show-modes -- both synonymous with ":set<CR>"
  812.  
  813.     show-help -- synonymous with ":help", '^A-h', etc.
  814.  
  815.     show-history -- displays the user's command line history.
  816.  
  817.     show-mapped-chars -- displays the strings mapped for command mode
  818.         with ":map".  (synonymous with ":map<CR>")
  819.  
  820.     show-mapped!-chars -- displays the strings mapped for insert mode
  821.         with ":map!".  (synonymous with ":map!<CR>")
  822.  
  823.     show-system-mapped-chars -- displays the strings mapped to
  824.         represent the terminal's function keys.
  825.  
  826.     show-registers -- displays the current contents of the named and
  827.         numbered registers.
  828.  
  829.     show-tagstack -- displays the contents of the "tags stack", the
  830.         list of locations from which the ":ta" or '^]' commands have
  831.         been used, and to which the ":pop" and '^T' (or '^X-^]')
  832.         commands will return.
  833.  
  834.     show-terminal-chars -- displays the list of special chars normally
  835.         associated with the TTY driver, i.e. backspace, interrupt,
  836.         suspend, etc.
  837.  
  838.     show-variables -- displays the list of vile $variables and user
  839.         %variables, and their values.
  840.  
  841. New Registers
  842. -------------
  843.     In addition to the usual "a through "z, and "1 through "9, vile
  844.     has additional registers.
  845.  
  846.     The register named '<' contains the last few hundred keystrokes
  847.     that have been typed by the user.  The principle use for this
  848.     is to make it easier to create :map commands based on commands
  849.     you've already given.  [It's also useful sometimes when debugging
  850.     to be able to see what key sequence led to a problem...]
  851.  
  852.     The register name '.' contains the current selected text in xvile.
  853.  
  854.     The register name '"' is a synonym for the default unnamed register,
  855.     which is also sometimes referred to as register 0.
  856.  
  857. Completion
  858. ----------
  859.     Many responses to vile prompts need not be typed in their entirety.
  860.     vile can complete the response for you.  This applies to command
  861.     names, file names, vile modes, vile variables, and the "terminal
  862.     characters".
  863.  
  864.     To invoke vile completion, type a few characters and hit TAB (or
  865.     your current "name-complete" terminal character).  Hitting it a
  866.     second time will pop up a window containing the list of possible
  867.     completions.  If there are more completions than will fit in the
  868.     window, hitting further TAB characters will cause that window
  869.     to scroll through the choices.  The window will go away when the
  870.     current command is finished.
  871.  
  872.     An older form of completion is also supported:
  873.         You can also type a question mark (or the current "test-
  874.         completions" terminal character) to display a list of the
  875.         characters that you would have to type to complete the command.
  876.         For example, to complete the "unmark" or "unmap" commands:
  877.         :unm?            -- you type
  878.         :unm{a}[pr]        -- you see
  879.         This style of completion-display shows curly braces around the
  880.         string that will be supplied by pressing TAB, and square
  881.         brackets around characters that you must type to make the
  882.         command unique.
  883.  
  884. Arrow keys
  885. ----------
  886.  
  887.     vile will understand your terminal's arrow keys, as long as they
  888.     are described correctly in the termcap/terminfo database.
  889.     The keys are interpreted as function keys, and are by default bound
  890.     to the up, down, left, and right screen motions.  These bindings
  891.     are honored in insert mode as well as command mode.
  892.  
  893. Rectangular regions
  894. -------------------
  895.  
  896.     Just as the regions defined by vi's commands and motions can either
  897.     be "exact", or encompass "full lines", regions in vile can in
  898.     addition be "rectangular".  The easiest way to use a rectangular
  899.     region is with the '\' motion, which, like '`' and ''', goes to a
  900.     named mark.  The region it describes, however, is "rectangular"
  901.     (instead of "exact" or "full line").  The following operators know
  902.     how to correctly act on rectangular regions:
  903.  
  904.     ^A-r    Opens up a rectangle.  Text to the right of the left
  905.         edge of the rectangle is shifted right by the width of
  906.         the rectangle.
  907.     >    Shift right.  Identical to '^A-r' when region is rectangular.
  908.     d    Deletes the (rectangular) region.  Text to the right moves
  909.         left to fill the rectangle.
  910.     <    Shift left.  Identical to 'd' when region is rectangular.
  911.     y    Yanks the (rectangular) region.  (vile remembers that the
  912.         yanked text is rectangular in shape.
  913.     c    Change the region.  If the region is _not_ rectangular,
  914.         insert mode is entered after the region is deleted.  If
  915.         the region _is_ rectangular, the user is prompted for
  916.         text with which the lines of the rectangle will be filled.
  917.     ^A-u ^A-l ^A-~ ^A-b    These four operators perform their character
  918.         transformations on rectangular regions, as well as exact or
  919.         full-line regions. (uppercase, lowercase, flip-case, and
  920.         blank, respectively)
  921.  
  922.     p P     The 'put'ting commands know whether the text being 'put' was
  923.         originally rectangular, and will do a rectangular insert
  924.         of the text, in front of or behind the cursor.  The
  925.         cursor position defines the upper left corner of the
  926.         insertion.
  927.     ^A-p    These two forms of the put command force the text being
  928.     ^A-P    'put' to be inserted as if it had been rectangular when
  929.         originally yanked or deleted.  The width of the rectangle
  930.         is the length of the longest line in register being 'put'.
  931.  
  932.     Note that because it is sometimes hard to manipulate rectangles
  933.     containing or bordering on tab characters, currently (for some
  934.     operations) vile "detabs" the region being operated on before
  935.     commencing, and re-entabs the lines again after the operation.  The
  936.     re-entabing is limited to leading whitespace, and of course is
  937.     suppressed if "notabinsert" mode is set.  [ This misfeature is
  938.     arguably a bug, and may be fixed.  In the meantime, you've been
  939.     warned. ]
  940.  
  941. Editor modes
  942. ------------
  943.  
  944.     Modes come in three "flavors".  They are universal, and affect the
  945.     editor generally, or are associated with either buffers or with
  946.     windows, and are usually inherited from a set of "global" buffer
  947.     and window modes.  The value of a buffer or window mode will track
  948.     changes to the respective global mode, until the "local" value is
  949.     set independently of the global one.
  950.  
  951.     To set or change a global mode, use ":set".  To remove the mode,
  952.     use ":unset", ":setno", or ":set" with the modename prefixed with
  953.     "no".
  954.  
  955.     To set and reset local modes, use ":setl", ":unsetl", ":setlno".
  956.  
  957.     To display modes, use ":setall", ":modes", or ":set all".  Local
  958.     mode values are only shown if they differ from the global values,
  959.     whether they have been independently set or not.  The "local"
  960.     version of the set/unset commands ("setl"/"unsetl") do not make
  961.     sense when used with universal modes, since there is only one
  962.     copy of these.
  963.  
  964.     The possible modes, with synonyms in parentheses, and a trailing U,
  965.     B or W indicating whether the mode is universal, or belongs to
  966.     buffers or windows, are:
  967.  
  968.     alt-tabpos (atp) If set, vile will position the cursor over tab and
  969.         control characters the way emacs would, that is, at the
  970.         start of a tab or control character display sequence.  If
  971.         turned off (the default), the cursor is positioned over
  972.         tabs and control characters the way it would be in vi, i.e.
  973.         at the end of the tab or control character display
  974.         sequence.  (To match the behavior of earlier versions of
  975.         vile, should be set.) (U)
  976.  
  977.     animated Controls whether vile automatically updates the contents of
  978.         scratch buffers when their contents would change.  The animated
  979.         buffers include:
  980.             [Binding List]
  981.             [Buffer List]
  982.             [Map Sequences]
  983.             [Map! Sequences]
  984.             [Registers]
  985.             [Settings]
  986.             [Terminal Characters]
  987.             [Tag Stack]
  988.         Turning off "animated" is rarely necessary: the capability
  989.         is present mostly as a debugging aid.  (B)
  990.  
  991.     autobuffer (ab) Controls whether vile uses "most-recently-used"
  992.         style buffering, or vi-style (command-line order) buffers.
  993.         That is, if autobuffer is on, then buffers are sorted in
  994.         order of use, in that buffers not frequently used will
  995.         drift to the end of the list.  If this mode is not on, then
  996.         vile will behave more like vi, in that buffers remain in a
  997.         fixed order, that in which they were edited. (U)
  998.  
  999.     autowrite (aw)  vile will write out any changed buffers for which
  1000.         this mode is set before performing a ^Z, "stop", "suspend",
  1001.         ":!<cmd>", or '^X-!<cmd>'.  The ":sh" command is not
  1002.         affected, nor is ":stop!" or ":suspend!".  Since buffers
  1003.         inherit the global value of a mode, simply setting the
  1004.         global autowrite value will cause all buffers to be
  1005.         auto-written.  Individual buffers can be forced or
  1006.         prevented from autowriting by setting the local value of
  1007.         the mode for those buffers appropriately.  [In real vi,
  1008.         autowrite mode will also force buffers to be written when
  1009.         switching between files.  This is unnecessary in vile.] (B)
  1010.  
  1011.     autoindent (ai) During insert, newly created lines inherit their
  1012.         leading indent from the previous line in the buffer. (B)
  1013.  
  1014.     autosave (as) Automatic file saving.  Writes the file after every
  1015.         'autosavecnt' characters of inserted text.  Other file
  1016.         changes are not counted.  (B)
  1017.  
  1018.     autosavecnt (ascnt) How often (after how many inserted characters)
  1019.         will automatic saves take place.  256 by default. (B)
  1020.  
  1021.     backspacelimit (bl)  When in insert mode, this controls whether
  1022.         one can backspace past the point at which the insert began. (B)
  1023.  
  1024.     backup-style  Specifies the style used for creating file backups
  1025.         when a file is written.  Can have values of "off", ".bak",
  1026.         and (under UNIX) "tilde", for no backups, DOS-style .BAK
  1027.         files, and file.c~ style backups, respectively.  Files
  1028.         are copied before being written, to protect links to
  1029.         the original file.  Permissions, modification and access
  1030.         times are all preserved.  If creation of the backup fails,
  1031.         the write of the file will fail, unless it is forced
  1032.         using the ":w!" form of the write command.  (U)
  1033.  
  1034.     bcolor    On systems supporting this, will set the background color.
  1035.         Currently only DOS can do color, although the X11 version
  1036.         (xvile) can be given colors at startup or via .Xdefaults.
  1037.         See notes about the color palette down below, under DOS
  1038.         specifics.
  1039.  
  1040.     check-modtime  Check modification-time.  If a file has changed since
  1041.         it was last read or written, vile will issue a "file newer
  1042.         than buffer" warning and prompt appropriately for
  1043.         confirmation when 1) popping up a window on an existing
  1044.         buffer, 2) reading or writing the buffer, or 3) after
  1045.         performing some shell command.  The prompt will occur only
  1046.         once, unless the modification time of the file changes
  1047.         again, in which case the warning will be repeated.  The
  1048.         warning will be repeated in any case if the file is being
  1049.         written.  Invoking a shell, or suspending/restarting vile,
  1050.         will cause all visible buffers (those currently in windows)
  1051.         to have their times checked immediately.
  1052.  
  1053.     cmode   C-code mode.  Also useful for other languages.  Maintains
  1054.         current indentation level automatically during insert, like
  1055.         autoindent, above.  If a line ends with a '{', '(', or ':',
  1056.         then the next line indents further.  If a line begins with
  1057.         a '}' or ')', it is lined up with the line containing the
  1058.         matching '{' or '('.  If a line starting with '#' is
  1059.         inserted it is moved to column 1.  Additionally, if a line
  1060.         begins with a '#' character, it will not shift right with
  1061.         the '>>' command.  If the global cmode is set, then the
  1062.         buffer's C mode is turned on automatically only for files
  1063.         whose names are matched by the c-suffixes regular
  1064.         expression (see below).  (B)
  1065.  
  1066.     crypt    Causes files to be encrypted.  This is NOT compatible
  1067.         with the UNIX crypt(1) routines, and may not be built
  1068.         into your version of vile by default. (B)
  1069.  
  1070.     c-shiftwidth (csw) Sets the value for the shiftwidth (see below)
  1071.         which will be used if a file is in cmode.  (B)
  1072.  
  1073.     c-tabstop (cts) Sets the value for spacing of tabstops which will
  1074.         be used if a file is in cmode.  (B)
  1075.  
  1076.     c-suffixes (csuf) A regular expression describing filenames for
  1077.         which cmode will be set.  This is arguably misnamed, since
  1078.         the regular expression need not describe only suffixes. (U)
  1079.  
  1080.     comments A regular expression defining commented paragraph
  1081.         delimiters.  This is used in addition to the "paragraphs"
  1082.         expression (see below) when reformatting a region.  The net
  1083.         effect is that paragraphs inside of these comments are
  1084.         preserved when doing text reformatting, but are not
  1085.         reachable with the '}' and '{' motions.  (B)
  1086.  
  1087.     dirc    Causes vile to check each name when scanning directories for
  1088.         filename completion.  This is slower, but provides additional
  1089.         information allowing you to distinguish between directory and
  1090.         file names in the prompt.  (U)
  1091.  
  1092.     dos    On input, if the global copy of this mode is set, then
  1093.         incoming CR/LF pairs are taken as line terminators, the CR
  1094.         characters are stripped out, and the local dos mode is set
  1095.         for the buffer.  (Actually, the local dos mode is only set
  1096.         if the _majority_ of lines had CR characters at the end.)
  1097.         If global dos mode is _not_ set, then incoming CR
  1098.         characters will be left visible on the screen (as '^M'),
  1099.         and the local mode will not be set.
  1100.  
  1101.         On output, when writing a buffer with local dos mode set,
  1102.         all lines will be terminated with CR/LF pairs, rather than
  1103.         the usual single LF.
  1104.  
  1105.         When buffers representing non-existent files are created
  1106.         they will inherit the line-style of the operating system
  1107.         (LF-only on UNIX and VMS, CRLF-style on DOS derivatives)
  1108.         regardless of the global setting of dos mode.
  1109.  
  1110.         Setting dos mode makes editing binary files unreliable.
  1111.         The global value for this mode is set on by default in DOS
  1112.         versions of vile, and should therefore be turned off if
  1113.         doing binary editing.  (B)
  1114.  
  1115.     errorbells (eb) Controls whether a bell sounds (or whether the
  1116.         screen flashes, if "flash" mode is on") when an error
  1117.         occurs. (U)
  1118.  
  1119.     expand-chars Controls the set of characters that are expanded in
  1120.         command lines.  These include
  1121.             '%' (the current buffer),
  1122.             '#' (the alternate buffer),
  1123.             '!' (the last shell command) and
  1124.             ':' (the token at the cursor position).  For VMS
  1125.                 and MS-DOS, this is '&'.
  1126.         (U)
  1127.  
  1128.     expand-path Controls whether %/# are expanded to the full pathname
  1129.         of a buffer, or just to its basename (i.e. the name with
  1130.         the path stripped off).  (U)
  1131.  
  1132.     fcolor    On systems supporting this, will set the foreground color.
  1133.         Currently only DOS can do color, although the X11 version
  1134.         (xvile) can be given colors at startup or via .Xdefaults.
  1135.         See notes about the color palette down below, under DOS
  1136.         specifics.
  1137.  
  1138.     fence-pairs  Each pair of characters in this string is taken to be
  1139.         a set of "fences", which should be matched with the '%'
  1140.         command.  The default value is "{}()[]", which produces
  1141.         normal vi behavior.  This can, for instance, be augmented
  1142.         with the '<' and '>' characters ("{}()[]<>") to cause angle
  1143.         brackets to be matched as well.  See "showmatch" mode for
  1144.         another use of the "fence-pairs" mode.  (B)
  1145.  
  1146.     fillcol (fc)  Sets the value for the fill column, which is the
  1147.         column at which autowrapping and region formatting will
  1148.         break lines.  (B)
  1149.  
  1150.     flash   If your terminal can, will flash the screen rather than
  1151.         beeping on errors.  No audible or visible indication will
  1152.         occur at all if "errorbells" mode is not set on.  (U)
  1153.  
  1154.     glob    Controls how wildcard characters (e.g., '*' and '?') are
  1155.         treated in prompts for filenames.  Set glob to 'off' to
  1156.         disable expansion, or to 'on' to use the internal globber.
  1157.         The internal globber will handle *, ?, [a-z] style ranges,
  1158.         environment variables, and the ~user notation for finding
  1159.         home directories.
  1160.  
  1161.         On UNIX, glob can be set to be a pipe command that
  1162.         will expand more wildcards.  The default value of
  1163.         glob on UNIX is "!echo %s", which should provide globbing
  1164.         that matches that of your shell.  If set to a command that
  1165.         will separate filenames with newlines or nulls rather than
  1166.         spaces, then filenames containing spaces may be more easily
  1167.         edited.  ("!/bin/ls -d %s" is one possibility, "!glob %s"
  1168.         is another if you use csh.) (U).
  1169.  
  1170.     history (hi) When true (the default), commands from the :-line are
  1171.         logged in a buffer [History].  Turning this off causes the
  1172.         buffer to be removed.  (U)
  1173.  
  1174.     horizscroll (hs) If the cursor is moved "off-screen", this mode
  1175.         controls what happens.  If set (as it is by default), the
  1176.         whole screen will shift sideways to make the cursor position
  1177.         visible.  If not set, then only the current line will shift,
  1178.         which may be desirable on slower displays. (W)
  1179.  
  1180.     ignorecase (ic) Text searches normally match the pattern exactly.
  1181.         With this set, searches are case-insensitive. (B)
  1182.  
  1183.     implybuffer (ib) Causes vile to create a buffer when you write to a new
  1184.         file, or read from one (e.g., with ":r").  (U)
  1185.  
  1186.     linewrap (lw) Displays lines that are too long to fit on one line as a
  1187.         series of "wrapped" lines.  Overrides left/right scrolling
  1188.         controlled by "sideways" and "horizscroll" modes.  (W)
  1189.  
  1190.     list    (li) The buffer will be displayed with tabs and newlines made
  1191.         visible, instead of as whitespace. (W)
  1192.  
  1193.     magic Honor unescaped regular expression metacharacters in search
  1194.         strings.  See the section "Regular Expressions" for more
  1195.         detail.  (B)
  1196.  
  1197.     meta-insert-bindings (mib)  Controls behavior of 8-bit characters
  1198.         during insert.  Normally, key-bindings are only operational
  1199.         when in command mode: when in insert mode, all characters
  1200.         are self-inserting.  If this mode is on, and a meta-character
  1201.         (i.e.  a character with the 8th bit set) is typed which is
  1202.         bound to a function, then that function binding will be
  1203.         honored and executed from within insert mode.  Any unbound
  1204.         meta-characters will remain self-inserting.  (B)
  1205.  
  1206.     multibeep If a motion command fails, then vile, like vi, will
  1207.         normally sound the bell.  Turning this mode off prevents
  1208.         subsequent identical motion failures from also sounding the
  1209.         bell.  That is, if you repeat a failed motion many times
  1210.         (e.g. by holding down the backspace key), you only get one
  1211.         beep.  (U)
  1212.  
  1213.     newline (nl) The buffer ends with a newline.  This is set when reading
  1214.         a buffer.  (B)
  1215.  
  1216.     number    (nu) All lines in the buffer will be prefixed by their line
  1217.         number. (W)
  1218.  
  1219.     maplonger Controls whether the longer or shorter of two "nested"
  1220.         map strings will be favored by the editor.  When set, vile
  1221.         will match the longest available mapped string.  When reset,
  1222.         (the default) vile will match the shortest available map.
  1223.         For more information, see the section describing the ":map"
  1224.         command, below.  (U)
  1225.  
  1226.     paragraphs A regular expression defining where the "next-paragraph"
  1227.         ('}') and "previous-paragraph" ('{') commands will go. (B)
  1228.  
  1229.     popup-choices (pc) Must be set to one of the following three
  1230.         values: "off", "immediate", or "delayed".  When enabled
  1231.         with either "immediate" or "delayed", vile pops up the
  1232.         [Completions] buffer showing choices for filename and
  1233.         command completion in response to a TAB.  "immediate" will
  1234.         force the buffer to be popped up immediately if no progress
  1235.         is made in forming a completion.  "delayed" will cause vile
  1236.         to wait until TAB is pressed a second time before popping
  1237.         up the completion choices.  (U)
  1238.  
  1239.     popup-msgs (pm) When enabled, vile pops up the [Messages] buffer
  1240.         showing the text that was written to the message line.
  1241.         Closing the window clears its content until the next
  1242.         message is written.  This is most useful during the
  1243.         debugging of macros, since many messages may appear, each
  1244.         overwriting a previous one.  (U)
  1245.  
  1246.     printing-low The integer value representing the first of the
  1247.         printable set of "high bit" (i.e. 8-bit) characters.
  1248.         Defaults to 0.  Most foreign (relative to me!) users would
  1249.         set this to 160, the first printable character in the upper
  1250.         range of the ISO 8859/1 character set.  (U)
  1251.  
  1252.     printing-high The integer value representing the last character of
  1253.         the printable set of "high bit" (i.e. 8-bit) characters.
  1254.         Defaults to 0.  Set this to 255 for ISO 8859/1
  1255.         compatibility.  (U)
  1256.  
  1257.     readonly (ro) Prevent writing a buffer to its associated file.  Unlike
  1258.         "view" mode (see below) which prevents any modifications to
  1259.         a buffer, this mode allows changes, but prevents updates.
  1260.         This is set automatically for the output of shell commands
  1261.         and pipes. (B)
  1262.  
  1263.     readonly-on-readonly (roro) Causes "readonly" mode to be set for
  1264.         read-only files.  Normally vile will attempt to write files
  1265.         whether the operating system will allow it or not.  This
  1266.         mode should be turned on to truly mimic vi's default
  1267.         behavior.  (U)
  1268.  
  1269.     remap   Controls whether :map or :map! sequences entered with
  1270.         no explicit remapping control should be subject to remapping
  1271.         (i.e. recursive mapping).  (U)
  1272.  
  1273.     remapfirst Controls whether the first character of a map expanded
  1274.         due to :map or :map! is eligible for remapping.  This is
  1275.         off by default for vi compatibility.
  1276.  
  1277.     report    A threshold value that is used to control messages that report
  1278.         the number of lines deleted, changed, etc.  (U)
  1279.  
  1280.     resolve-links Controls whether vile fully resolves file names in
  1281.         cases where some path components are symbolic links.  This
  1282.         makes vile smarter about symbolic links that provide
  1283.         multiple paths to a given file (preventing multiple
  1284.         unintentional edits of the same physical file via different
  1285.         pathnames).  It may trigger long timeouts on systems where
  1286.         symbolic links are used in conjunction with NFS automounted
  1287.         directories.  (Note that this does not detect or prevent
  1288.         multiple edits caused by hard file links -- only symbolic
  1289.         ones.) (U)
  1290.  
  1291.     ruler Shows the current line and column in the status line, as
  1292.         well as what percentage of the current buffer's lines lie
  1293.         in front of the cursor.  (This percentage is different than
  1294.         that given by ^G (the "position" function), which gives a
  1295.         percentage of characters rather than lines.) (B)
  1296.  
  1297.     samebangs (sb) Controls whether the ":!!" and "^X-!" commands
  1298.         remember the same command string.  (U)
  1299.  
  1300.     sections A regular expression defining where the "next-section" (']')
  1301.         and "previous-section" ('[') commands will go. (B)
  1302.  
  1303.     shiftwidth (sw) This is much like a tabstop, except that it is
  1304.         independent of hardware tabs and tab characters.  It is the
  1305.         number of columns a line will shift by if the '<<' or '>>'
  1306.         commands are used, and it chooses the next column stop for
  1307.         the cursor if a '^T' or '^D' is typed during insert mode. (B)
  1308.  
  1309.     showmatch (sm) During insert, if a closing "fence" character
  1310.         (usually '}', ']', or ')', but may be changed by setting
  1311.         "fence-pairs") is typed, the cursor will highlight the
  1312.         matching member of the pair for about a quarter second.
  1313.         (B)
  1314.  
  1315.     showmode (smd) Causes an indicator on the modeline to indicate what
  1316.         mode vile is currently in: insert (I), replace (R), or
  1317.         command (none).  (B)
  1318.  
  1319.     showram (sr) Displays the amount of ram currently allocated at the
  1320.         end of the message line. (not in all versions) (U)
  1321.  
  1322.     sideways  Will prompt for a new value for the sideways scroll offset,
  1323.         which allow display of a section of code normally off the
  1324.         screen to the right.  Also affected by the ^X-^R and ^X-^L
  1325.         commands.  (W)
  1326.  
  1327.     smoothscroll (ss) Force smooth scrolling.  By default, this option
  1328.         is turned off so that vile will try to keep up with your
  1329.         keystrokes instead of keeping the display up to date.  Some
  1330.         keyboards repeat faster than the screen can keep up causing
  1331.         the screen to jump.  If this bothers you, set smoothscroll
  1332.         to true.  Warning: If your keyboard repeats really fast and
  1333.         you have smoothscroll enabled, it may take a while for vile
  1334.         to catch up.  (U)
  1335.  
  1336.     tabinsert (ti) Allow the physical insertion of tab characters into
  1337.         the buffer.  If turned off ("notabinsert"), and an attempt
  1338.         is made to insert a tab character by explicitly typing it
  1339.         or by using shiftwidth or the line shifting commands, then
  1340.         the appropriate number of space characters will be inserted
  1341.         instead.  Use '^V^I' to insert a real tab, and remember
  1342.         that pre-existing tabs will not be affected.  Use the
  1343.         '^A-<SP>' operator command to eliminate pre-existing tabs
  1344.         from a region of text.  (B)
  1345.  
  1346.     tabstop (ts) Set the value for spacing of normal tabstops. (B)
  1347.  
  1348.     taglength (tl) Sets the significant length for tags.  If non-zero,
  1349.         lookups for names longer than the taglength value will only
  1350.         attempt to match that many characters.  If a lookup is for
  1351.         a shorter pattern, or the value of taglength is zero, then
  1352.         the tags must match the lookup pattern exactly.  This will
  1353.         not effect tags picked up from the cursor -- they are
  1354.         always matched exactly.  (B)
  1355.  
  1356.     tagrelative (tr) Causes files looked up via the tags mechanism to
  1357.         be found relative to the location of the tags file, rather
  1358.         than relative to the current directory. This allows the
  1359.         same tags file to be useful from different locations, while
  1360.         not requiring absolute filenames.  For example, using
  1361.         `set tags "tags ../tags"' would allow a single tags file
  1362.         (located in the parent) to be used in a small source
  1363.         hierarchy from either the parent or a child directory.  (B)
  1364.  
  1365.     tags    Gives a path of names of file(s) in which to look up
  1366.         tag references.  It is a whitespace-separated list of
  1367.         filenames.  Relative pathnames in this list are evaluated
  1368.         with respect to the current directory of vile at the time
  1369.         of the tags lookup.  (B)
  1370.  
  1371.     terse   vile produces more "status" messages than vi, which may
  1372.         become annoying at low baud rates.  Setting terse mode will
  1373.         suppress many of these.  (B)
  1374.  
  1375.     terse-selections (tsel)  Boolean indicating whether or not additional
  1376.         information is displayed about a selection.  When false, the
  1377.         starting and ending positions of the selection are displayed
  1378.         as the selection is extended.  The default is true. (W)
  1379.  
  1380.     timeoutlen  How long to wait for the characters of a :map'd sequence.
  1381.         Typically needed to resolve the ambiguity between a
  1382.         user-pressed ESCape key and an ESC character that is part
  1383.         of a function key sequence.  vile will wait for "timeoutlen"
  1384.         milliseconds after seeing an ESC, in order to check the
  1385.         next character of input.  The time defaults to 500, or half
  1386.         a second.  Users of fast local screens, like a local xterm,
  1387.         may wish to reduce this to something like 50 for crisper
  1388.         response to a user-pressed ESC.  (U)
  1389.  
  1390.     timeoutlen-user  If set non-zero, this will enforce a maximum
  1391.         waiting time for characters in a user-defined :map sequence.
  1392.         If zero, the value of timeoutlen, above, will be used for
  1393.         both "system" and user sequences.  It is likely that a
  1394.         short time is desired for system sequences, and a long time
  1395.         for user sequences.  For this reason the default value of
  1396.         timeoutlen-user is 60000.  This will give a full minute to
  1397.         type each character of a user-defined :map.  Be careful --
  1398.         extremely large values may overflow the word size on
  1399.         smaller machines, i.e, you will probably want to avoid
  1400.         setting timeoutlen-user larger than 65535.  (U)
  1401.  
  1402.     undolimit (ul) Sets a limit on how many undoable buffer-changing
  1403.         commands will be saved.  If set to 0, there is no limit,
  1404.         and all changes are undoable.  The default value is 10. (B)
  1405.  
  1406.     unprintable-as-octal (uo) If an 8-bit character is non-printing, it
  1407.         will normally be displayed in hex.  This setting will force
  1408.         octal display.  Non-printing characters whose 8th bit is
  1409.         not set are always displayed in control character (e.g. '^C')
  1410.         notation.  (B)
  1411.  
  1412.     view    View the file only.  No changes are permitted.  (B)
  1413.  
  1414.     view-on-readonly (viewro) Causes "view" mode to be set for
  1415.         read-only files.  (U)
  1416.  
  1417.     visual-matches When a search command is executed, the cursor will
  1418.         move as usual.  In addition, all matching occurrences of
  1419.         the searched-for pattern (in the current buffer) will be
  1420.         emphasized according to the value of this mode: "none",
  1421.         "underline", "bold", "italic", or "reverse".  The '='
  1422.         command can be used to clear this sort of highlighting,
  1423.         until the next search is done for a different pattern.
  1424.         Note that setting this mode can significantly slow down the
  1425.         editor's operation when complex or frequently occurring
  1426.         patterns are used, since vile will need to scan the entire
  1427.         buffer for matches on any change to the buffer.  (B)
  1428.  
  1429.     warn-rename  When using ":e" to find a file that has the same name
  1430.         as another buffer, vile will normally offer for you to edit
  1431.         the proposed alternate name for the buffer constructed by
  1432.         adding a "-1", "-2", etc. to the end of the name.  Turning
  1433.         off "warn-rename" will make vile choose buffer names without
  1434.         user intervention.  (U)
  1435.  
  1436.     warn-reread  When using ":e!" to reread a buffer from the file on
  1437.         disk, vile will normally warn you that you are about to
  1438.         clobber a modified buffer.  Turning off "warn-reread" mode
  1439.         will make vile assume you known what you are doing.  (U)
  1440.  
  1441.     warn-unread  When leaving the editor, if not all buffers have been
  1442.         "visited", then normally vile will complain, and remind the
  1443.         user to use ":q!".  Turning off "warn-unread" mode will
  1444.         suppress this behavior.  (U)
  1445.  
  1446.     working If turned off (noworking), will suppress the activity
  1447.         indicator ("working..."/"...working") which appears during
  1448.         long-running operations.  (U)
  1449.  
  1450.     wrapmargin (wm)  Implements vi's auto-wrap mode.  If nonzero, the
  1451.         wrapmargin specifies the number of columns on the
  1452.         screen's right margin to reserve before breaking the input
  1453.         lines on a preceding space.  Thus a value of 5 and an
  1454.         80 column screen will result in 75 character lines.  This
  1455.         mode is different from the "wrapwords" mode (below) which
  1456.         uses the "fillcol" setting as its target column.  The two
  1457.         modes probably shouldn't both be used at once.
  1458.         (B)
  1459.  
  1460.     wrapscan (ws) Text searches will continue from past the bottom of
  1461.         the file to the top, and vice-versa.  (B)
  1462.  
  1463.     wrapwords (ww) [deprecated] Similar to, but different from, vi's
  1464.         auto-wrap mode (i.e. "wrapmargin").  While inserting,
  1465.         words are moved to the next line if the current line gets
  1466.         too long.  Wrapping is only attempted when a space is
  1467.         typed.  The target maximum width of lines is changed with
  1468.         the "fillcol" setting.  (B)
  1469.  
  1470.     xterm-mouse Enables mouse-clicking if you are running within an
  1471.         xterm.  That is, it allows vile to receive mouse events.
  1472.         Since this mode overrides xterm's cut & paste, you will
  1473.         need to use the Shift key when pressing the mouse buttons
  1474.         to cut and paste between X windows.  Your TERM variable's
  1475.         termcap entry must contain the string "xterm" for this to
  1476.         work.  (U)
  1477.  
  1478. 8-Bit Operation
  1479. ---------------
  1480.  
  1481.     vile allows input, manipulation, and display of all 256 possible
  1482.     byte-wide characters.  (Double-wide characters are not supported.)
  1483.  
  1484.     Output
  1485.     ------
  1486.     By default, characters with the high bit set (decimal value 128 or
  1487.     greater) will display as hex (or octal; see "non-printing- octal"
  1488.     above) sequences, e.g.  \xA5.  A range of characters which should
  1489.     display as themselves (that is, characters understood by the user's
  1490.     display terminal) may be given using the "printing-low" and
  1491.     "printing-high" settings (see above).  Useful values for these
  1492.     settings are 160 and 255, which correspond to the printable range
  1493.     of the ISO-Latin-1 character set.
  1494.  
  1495.     Input
  1496.     -----
  1497.  
  1498.     There are basically three ways of getting 8-bit characters into
  1499.     a vile buffer:
  1500.  
  1501.     Directly -- if the user's input device (i.e. the terminal or
  1502.         xterm) can generate all characters, and if the terminal
  1503.         settings are such that these characters pass through
  1504.         unmolested, then vile will happily incorporate them into the
  1505.         user's text, or act on them if they are bound to functions.  On
  1506.         an xterm, try "stty cs8 -parenb -istrip".  Real serial lines
  1507.         may take more convincing, at both ends, but use that stty
  1508.         command as a starting point.
  1509.  
  1510.     As numbers -- the ^V prefix (or, more correctly, the key bound to
  1511.         the "quote-next-character" function), if followed by up to
  1512.         three digits, will insert a character whose value is that
  1513.         number (no greater than 255) into the buffer.  The number may
  1514.         be entered in decimal (^VNNN), octal with a leading '0' (^V0NNN),
  1515.         or hex with a leading 'x' (^VxNN).
  1516.  
  1517.     As digraphs -- Perhaps more useful to some people is using a set of
  1518.         ":map!" commands to aid insertion of 8-bit text.  The file
  1519.         "digraphs.rc" distributed with the vile source contains a set
  1520.         of mappings which should aid the input of ISO 8859/1 text.  As
  1521.         examples, the mappings in digraphs.rc allow one to type ^Ku"
  1522.         to get an umlaut character, ^K12 to get the little '1/2'
  1523.         symbol, ^KY- to get the Yen currency symbol, or ^K:- to get an
  1524.         arithmetic division symbol.
  1525.  
  1526.     Users who have no need to enter 8-bit text may want access to the
  1527.     meta-bound functions while in insert mode as well as command mode.
  1528.     The mode "meta-insert-bindings" controls whether functions bound to
  1529.     meta- keys (characters with the high bit set) are executed only in
  1530.     command mode, or in both command and insert modes.  In either case,
  1531.     if a character is _not_ bound to a function, then it will be
  1532.     self-inserting when in insert mode.  (To bind to a meta key in the
  1533.     .vilerc file, one may specify it as itself, or in hex or octal, or
  1534.     with the shorthand 'M-c' where c is the corresponding character
  1535.     without the high bit set.
  1536.  
  1537.     (Although it is possible to edit and view all 256 characters, it is
  1538.     currently impossible to _search_ for a string that contains the NULL
  1539.     character, since this is used internally to terminate the search
  1540.     string.)
  1541.  
  1542. Command History
  1543. ---------------
  1544.  
  1545.     You may scroll through the list of previous replies to the :-prompt
  1546.     by using the up- or down-arrow special keys on your keyboard (if
  1547.     your configuration supports it).
  1548.  
  1549. Special Character Expansion
  1550. ---------------------------
  1551.  
  1552.     As in vi, the % and # characters typed while responding to a prompt
  1553.     will expand to the current or "alternate" filename.
  1554.  
  1555.     Also as in vi, the ~ character will expand to be the previous
  1556.     replacement pattern when entering either a replacement or search
  1557.     pattern,
  1558.  
  1559.     In addition, the colon character (":") expands at most prompts to
  1560.     be the identifier name under the cursor.
  1561.  
  1562.     Expansion of ! to the last command run is implemented, but only
  1563.     when a shell command is being entered.
  1564.  
  1565.     Any of these expansions can be suppressed by prefixing with a '\'.
  1566.  
  1567. Key Rebinding
  1568. -------------
  1569.  
  1570.     There is a key rebinding facility (if vile is built to include it),
  1571.     which is invoked as follows.  One must know the "english" name for the
  1572.     command being rebound.  Use ":show-commands" or ":apropos string"
  1573.     to find english names containing "string".  Then use the command:
  1574.         ":bind-key englishname keyseq"
  1575.     where keyseq is the exact keyboard sequence (i.e. single character,
  1576.     or '^X', '^A', or '#' followed by a single character) to which the
  1577.     command should be bound.  In a .vilerc file, keyseq can be either
  1578.     the literal sequence, or the printable representation of the
  1579.     sequence, e.g. ^A-a or ^X-S.   (A summary of how key-sequences can
  1580.     be represented appears at the end of this section.)
  1581.  
  1582.     Commands can also be bound to meta keys, which are regular ASCII
  1583.     characters with the eighth bit (0x80) bit set.  The "printable"
  1584.     form for these keys is 'M-c'.
  1585.  
  1586.     Commands bound to '#-c' key sequences are usually also available
  1587.     by using the function keys on the terminal.  Thus the up-arrow
  1588.     function key can be bound to as '#-A'.
  1589.  
  1590.     Even the ^A and ^X prefix characters can be rebound, using the
  1591.     dummy functions "cntl_a-prefix" and "cntl_x-prefix", and the '#'
  1592.     key itself can be rebound -- it is represented by the command name
  1593.     "function-prefix".
  1594.  
  1595.     Examples:
  1596.      To cause the / and ? commands to perform incremental
  1597.       searches, use:
  1598.         bind-key incremental-search /
  1599.         bind-key reverse-incremental-search ?
  1600.      To make ^N and ^P switch windows instead of cause motion by lines,
  1601.        try:
  1602.         bind-key next-window ^N
  1603.         bind-key previous-window ^P
  1604.      To cause the space bar to move forward by pages, as in the "more"
  1605.       command, use:
  1606.         bind-key next-page \s
  1607.  
  1608.     (Space and tab can be represented with: "\s" and "\t".)
  1609.  
  1610.     Note that when interactive, ^A and ^X are typed using the control
  1611.     key.  In a file, however, they can be either a caret (^) followed
  1612.     by a letter, or the literal control key.  In the latter case you
  1613.     would not use the '-' separator.  So ^A-x as four distinct
  1614.     characters could also be entered as ^Ax, which would only be two
  1615.     characters.
  1616.  
  1617.     Characters can be entered in hex or octal as well, in the form
  1618.     0xNN, where NN is exactly two hex digits.  So if you know the hex
  1619.     value for a key, you can bind to it like:
  1620.         bind-key next-window ^A-\x14
  1621.     or
  1622.         bind-key next-window #-\213
  1623.  
  1624.     The sequence 'M-', represents a "meta-key", or a "meta" character.
  1625.     It is equivalent to setting the high bit of the following
  1626.     character, so 'M-e' is has the value of (0x80|0x65), or 0xe5.
  1627.  
  1628.     Function and meta-key bindings are available in insert mode, as
  1629.     well as in command mode.  (But only via either the "meta bit" or
  1630.     ESC sequence form -- the '#' prefix will not work in insert mode.)
  1631.     So the following macro will work correctly in both command and
  1632.     insert modes:
  1633.  
  1634.         15 store-macro
  1635.             insert-string "fprintf(stderr, \""
  1636.             set-named-mark z
  1637.             insert-string "\\n\");\n"
  1638.             goto-named-mark-exact z
  1639.             ; enter insert mode if we weren't already there
  1640.             ~if &seq $mode "command"
  1641.                 insert-chars
  1642.             ~endif
  1643.         ~endm
  1644.         ; bind to function key f
  1645.         bind-key execute-macro-15 #-f
  1646.         ; also bind to meta-A
  1647.         bind-key execute-macro-15 M-A
  1648.  
  1649.     Actually the "meta-insert-bindings" setting controls whether meta-
  1650.     keys will have their bound effect when in insert mode.  If this
  1651.     setting is not on (or if the meta-key is not bound to any function)
  1652.     then the key's value will simply be inserted into the buffer.
  1653.  
  1654.  
  1655.     Syntax for key-sequences:
  1656.     -------------------------
  1657.     To summarize, a key-sequence being bound to is specified with:
  1658.         1) an optional prefix, like this:
  1659.             ^A-    (three chars)
  1660.             ^X-    (three chars)
  1661.             ^A    (one char)
  1662.             ^X    (one char)
  1663.  
  1664.         2) followed by an optional "function" prefix:
  1665.             #-    (two chars)
  1666.  
  1667.         3) followed by an optional "meta" prefix:
  1668.             M-    (two chars)
  1669.             (this is the same as with specifying a character
  1670.                 in that has the high bit set)
  1671.  
  1672.         4) followed by a character, like this:
  1673.             C    (one char)
  1674.             ^C    (one char)
  1675.             ^C    (two chars)
  1676.             \NNN    (max of four chars, where NNN are octal digits)
  1677.             \xNN    (max of four chars, where NN are hex digits)
  1678.             \n,\r,\t,\b,\f,\a (two chars each, usual meanings)
  1679.             \e    (two chars, means ESC)
  1680.             \s    (two chars, means SPACE)
  1681.  
  1682.     (The "one char" control character entries in the above table are
  1683.     represented in this help file as two printable characters, to
  1684.     ensure they are not deleted by mailers or file transfer programs.)
  1685.  
  1686.     Function Keys
  1687.     -------------
  1688.     When you bind to a function key, you will see its value printed
  1689.     as a 'poundsign' sequence.  And, if you wish to :map a function
  1690.     key, you will need to use its poundsign sequence.  This is
  1691.     explained more fully below.
  1692.  
  1693.     The list of function key labels, along with their "vile name",
  1694.     are as follows:
  1695.  
  1696.        Usual Label    Vile name     Usual Label    Vile name
  1697.        -----------    ---------     -----------    ---------
  1698.         Up-arrow        #A          Home            #H
  1699.         Down-arrow      #B          End             #E
  1700.         Left-arrow      #D          Insert          #i
  1701.         Right-arrow     #C          Delete          #d
  1702.         Prior (PageUp)  #p          Find            #f
  1703.         Next (PageDown) #n          Select          #s
  1704.         Help            #?        Menu            #m
  1705.         F1              #1          F12             #@
  1706.         F2              #2          F13             ##
  1707.         F3              #3          F14             #$
  1708.         F4              #4          F15             #%
  1709.         F5              #5          F16             #^
  1710.         F6              #6          F17             #&
  1711.         F7              #7          F18             #*
  1712.         F8              #8          F19             #(
  1713.         F9              #9          F20             #)
  1714.         F10             #0          F11             #!
  1715.         KeyPad_F1       #P          KeyPad_F3   #R
  1716.         KeyPad_F2       #Q          KeyPad_F4   #S
  1717.  
  1718.         In addition, #M, #t, and #T are used internally to support
  1719.         mouse operations in an xterm.  To undo the relationship
  1720.         between a "system-defined" function key and the poundsign
  1721.         sequence it produces, use ":unmap-system-chars".
  1722.  
  1723.  
  1724.     :map, :map!, :noremap, :noremap!
  1725.     ---------------------------------
  1726.     The vi "map" and "map!" commands are implemented in vile.  As in
  1727.     vi, mapping works best if the character sequence being bound
  1728.     corresponds to pressing a single key.  Multiple key sequences will
  1729.     work as long as the next key in the sequence is pressed within a
  1730.     specified number of milliseconds.  The value of "timeoutlen" is
  1731.     used for system-defined character sequences, i.e. function keys.
  1732.     User defined sequences will use this too, unless the value of
  1733.     "timeoutlen-user" is non-zero, in which case this value will be
  1734.     used instead.
  1735.  
  1736.     Because "map" and "map!" may be used to remap arbitrary sequences,
  1737.     these sequences must be entered literally, i.e, the syntax for
  1738.     key sequences as listed above will not work for "map" and "map!".
  1739.     To enter control characters into a .vilerc file, use the ^V escaping
  1740.     mechanism.  A map command entered from the command line will require
  1741.     fewer characters be escaped with ^V.
  1742.  
  1743.     To provide a relatively portable way of specifying function key
  1744.     mappings, vile will reapply mapping to the result of a system-
  1745.     defined map.  System function keys are mapped to "poundsign"
  1746.     sequences, like '#1' for function key 1, and '#B' for the down-arrow
  1747.     key.  The remapping allows one to put
  1748.         map #1 <some-user-map-sequence>
  1749.     in the .vilerc file, and have the user-sequence executed when the
  1750.     system F1 key is pressed.  (Otherwise the terminal-specific
  1751.     sequence would have to appear in the .vilerc.)  See the section
  1752.     on "Function Keys" above for a full list.
  1753.  
  1754.     The "remap" option controls whether the successfully mapped result
  1755.     of a map is reevaluated for more mapping matches.  The "noremap" (and
  1756.     "noremap!") variants of the map commands will force that particular
  1757.     mapping to be applied without subsequent remapping, regardless of
  1758.     the current setting of the global "remap" setting.
  1759.  
  1760.     Since key sequences starting the '^X', '^A', or '#' prefixes
  1761.     are normally expected to act as a unit, no remapping is done on
  1762.     characters that follow such prefixes.  For instance, this keeps a
  1763.     map like:
  1764.         :map h ihello<ESC>
  1765.     from breaking the '^X-h' command.
  1766.  
  1767.     Long running loops caused by recursive :map definitions are
  1768.     detected and assumed to be infinite.  When such a loop is detected,
  1769.     execution is aborted.  Turning off the "remap" option, or doing
  1770.     some of the maps with the ":noremap/:noremap!" form of the map
  1771.     commands will eliminate most such loops.
  1772.  
  1773.     vile normally duplicates real vi's behavior (but not vim's) in that
  1774.     the first character of the sequence being mapped to is not subject
  1775.     to recursive (map) evaluation.  Assuming "remap" is on, pressing
  1776.     'j' when ":map j jh" is in effect will not cause an infinite loop,
  1777.     whereas ":map j hj" _will_ cause such a loop.  Setting the
  1778.     "remapfirst" option will allow this sort of remapping (and will
  1779.     cause an infinite loops for both examples).
  1780.  
  1781.     The "maplonger" option controls whether the longer or shorter of
  1782.     two "nested" map strings will be favored by the editor.  That is,
  1783.     if both "foo" and "foobar" are mapped (to presumably different
  1784.     values), then with "maplonger" set, vile will not expand "foo" until
  1785.     it is sure (either because the next character is not 'b', or a
  1786.     timeout has expired) that "foobar" will not be seen.  Real vi will
  1787.     always expand "foo" immediately, and this is the default behavior.
  1788.     Though not particularly recommended, the "maplonger" mechanism even
  1789.     permits the following types of mappings:
  1790.  
  1791.         :map z j
  1792.         :map zz k
  1793.  
  1794.     When 'z' is pressed by itself it will cause vile to move down one
  1795.     line (assuming j has not been rebound or remapped).  But if 'z' is
  1796.     pressed twice rapidly (enough) in succession, vile will move to the
  1797.     previous line.
  1798.  
  1799.     The left hand side of a map[!] definition may contain the usual
  1800.     backslash escapes:  \n, \r, \t, \b, \f, \a (^G), \e (ESC),
  1801.     \s (SPACE), \xNN (hex), \NNN (octal).  The right hand side is
  1802.     taken exactly literally, so special characters must be expressed
  1803.     as themselves.
  1804.  
  1805.     The current set of mappings or "map!"ings may be viewed with
  1806.     the commands ":map<CR>" (or ":show-mapped-chars") or ":map!<CR>"
  1807.     (or ":show-mapped!-chars").
  1808.  
  1809.     The system-defined maps, representing the function keys, may be
  1810.     shown with ":show-system-mapped-chars".
  1811.  
  1812.     To undo a mapping, use "unmap", "unmap!", or "unmap-system-chars".
  1813.  
  1814.     :abbr
  1815.     ------
  1816.     The "abbr" command is also present in vile.  It is similar to, but
  1817.     slightly different than, "map!".  Whereas "map!" examines
  1818.     characters as they are typed, continuously looking for a match
  1819.     against the stored translation strings, the "abbr" command examines
  1820.     them after they are already in the buffer, and is more sensitive to
  1821.     their surrounding context.
  1822.  
  1823.     First, abbreviations are never expanded unless followed by
  1824.     non-"word" characters.  In addition, abbreviations which begin like
  1825.     a "word" (i.e. with letters, digits, or the '_' character) are not
  1826.     expanded if they immediately follow another "word" character --
  1827.     they must follow whitespace or punctuation or the beginning of the
  1828.     line.  Likewise, abbreviations that begin with a punctuation
  1829.     character are not detected within more punctuation -- they must
  1830.     follow whitespace or a "word", or the beginning of the line.
  1831.  
  1832.     If the "backspacelimit" setting is set (and it is, by default),
  1833.     then characters not inserted during the current insertion command
  1834.     are not considered in the above comparisons -- the start of the
  1835.     current insertion behaves much like the beginning of line in that
  1836.     case.
  1837.  
  1838.     Abbreviations are never recursive.
  1839.  
  1840.     vile is more lenient than vi regarding what is a valid
  1841.     abbreviation.  vi insists that an abbreviation be all "word"
  1842.     characters, or be all "non-word" characters, except for the last
  1843.     character, which _must_ be a "word" character.  vile allows
  1844.     anything at all to be abbreviated, only enforcing the expansion
  1845.     rules mentioned above.
  1846.  
  1847.     To undo an abbreviation, use "unabbreviate".
  1848.  
  1849. Special "Terminal" Key Rebinding
  1850. --------------------------------
  1851.  
  1852.     In addition to the above binding mechanism for vile commands, other
  1853.     keystrokes to the editor are rebindable using the "set-terminal"
  1854.     command.  These keystrokes are mostly derived directly from the
  1855.     user's tty settings on entering the editor, but there are a couple
  1856.     of additions related to command and filename completion.
  1857.  
  1858.     The values of these characters can be shown with the "show-terminal"
  1859.     command, and can be changed with the "set-terminal" command.
  1860.  
  1861.                 Default value        Typical value
  1862.     -------------------------------------------------------------
  1863.     backspace        from tty settings    (DEL or ^H)
  1864.     interrupt        from tty settings    (^C or DEL)
  1865.     line-kill        from tty settings    (^U or @)
  1866.     name-complete        <tab>
  1867.     quote-next        from tty settings    (^V)
  1868.     start-output        from tty settings    (^Q)
  1869.     stop-output        from tty settings    (^S)
  1870.     suspend            from tty settings    (^Z)
  1871.     test-completions    ?
  1872.     word-kill        from tty settings    (^W)
  1873.  
  1874. Flow-control
  1875. ------------
  1876.     Historically, the flow of data between the computing host and the
  1877.     user's terminal was throttled through the use of special characters
  1878.     in the input stream, known as XON and XOFF (whose values are ^Q and
  1879.     ^S respectively).  Most modern systems do not need these
  1880.     characters, and regulate the flow in an "out-of-band" manner.  The
  1881.     terminal device driver, however, is usually still set up with
  1882.     software flow control enabled, to allow the user to manually start
  1883.     and stop output with the ^S and ^Q characters.
  1884.  
  1885.     vile normally resets the driver to allow the ^S and ^Q characters
  1886.     to be bound to commands, since most systems no longer need software
  1887.     flow control, and since there is usually no reason for a user to
  1888.     wish to suspend output when running vile.  Some older devices
  1889.     (usually older slower terminals), however, still need to be able to
  1890.     automatically control the data flow by generating ^S/^Q without the
  1891.     user's intervention.
  1892.  
  1893.     To accommodate these situations, the "flow-control-enable" command
  1894.     will reset the terminal driver to its original state.  Software
  1895.     flow-control will be re-enabled, and commands bound only to the ^S
  1896.     and ^Q characters will be inaccessible.  The characters affected
  1897.     in this way may be seen with the "show-terminal-chars" command,
  1898.     where they will appear as the "start/stop-output" characters.
  1899.     The action of the "flow-control-enable" command will be reversed
  1900.     if it is given any argument.
  1901.  
  1902. Recorded macros
  1903. ---------------
  1904.  
  1905.     The first type of macro in vile is for temporary, quick macro
  1906.     usage, and lets you record a macro as you execute vile commands.
  1907.     You can then replay those keystrokes with a single key.
  1908.  
  1909.     ^X-(    Begin recording a keyboard macro.  The keystrokes you type
  1910.         are recorded, until you use ^X-).
  1911.     ^X-)    Finish recording a keyboard macro.
  1912.     ^X-&    Execute the keyboard macro.
  1913.     ^X-^    Copy recorded keyboard macro to a named register, for saving,
  1914.         or for execution using '@a', as below.  (Type "a^X^ )
  1915.  
  1916.     The vi '@' command is present as well, and can be used to execute
  1917.     the contents of a named register as if it were entered at the
  1918.     keyboard.  To make this more useful, the "load-register" command
  1919.     will allow preloading a named register, from .vilerc file.  For
  1920.     example:
  1921.         use-register a load-register ihello^[
  1922.     will load register 'a' with a command to insert the word "hello".
  1923.     (The ^[ should be a real ESC character, entered by preceding it
  1924.     with ^V.)  A better example, is this:
  1925.         use-register w load-register ":!chmod +w %^M:w^M"
  1926.     which makes the current file writable and writes it.  (Again, use
  1927.     ^V to get the CR characters into the .vilerc file.)
  1928.  
  1929. Programmed procedures and macros
  1930. --------------------------------
  1931.  
  1932.     [ For more/different information on programmed macros, refer
  1933.     to the file "macros.doc", supplied with the vile source code. ]
  1934.  
  1935.     vile can also be extended by defining macros and then binding
  1936.     the execution of those macros to key sequences.  For instance, if
  1937.     the following lines appear in a .vilerc file:
  1938.         1 store-macro
  1939.          5 delete-til next-word
  1940.         ~endm
  1941.         bind-key execute-macro-1 ^A-1
  1942.     then when ^A-1 is executed, 5 words will be deleted.  The "-til"
  1943.     suffix on an englishname denotes that it is a vi operator style
  1944.     command, and expects to be followed by a motion command.  Also,
  1945.         1 store-macro
  1946.          5 delete-til lines
  1947.         ~endm
  1948.     would be the equivalent of "5dd" since the word "lines" represents
  1949.     the stuttered 'dd' style of operation.  More examples are given
  1950.     down below.
  1951.  
  1952.     Variables
  1953.     ---------
  1954.     There are some built-in variables that can be used in macros to gain
  1955.     access to parts of vile status, and parts of the current buffer.
  1956.     Built-in variables are accessed by name, prefixed with the '$'
  1957.     character.  There are two types of built-in variables (the environment
  1958.     variables, and mode values).  The environment variables are:
  1959.  
  1960.     $abufname    alternate buffer name (i.e. last visited)
  1961.     $buffer-hook    name of procedure to run when switching to a buffer
  1962.     $cbufname    current buffer name
  1963.     $cd-hook    name of procedure to run when changing directories
  1964.     $cfilname    current file name
  1965.     $char        character under the cursor
  1966.     $cryptkey    encryption key                (write only)
  1967.     $curcol        current column position of cursor
  1968.     $curline    current line in file
  1969.     $cwd        current directory
  1970.     $cwline        line offset in current window
  1971.     $debug        macro debugging -- set true for line by line tracing
  1972.     $directory    controls location of temp-files
  1973.     $discmd        display commands on command line
  1974.     $disinp        display command line input characters
  1975.     $exit-hook    name of procedure to run when quitting
  1976.     $flicker    set true to suppress CGA flicker on a PC.  ugh.
  1977.     $font        current font name (X11 version only)
  1978.     $forward-search    search direction, true=forward
  1979.     $helpfile    help-filename (vile.hlp)
  1980.     $iconname    current icon name (X11 version only)
  1981.     $identifier    current punctuated word
  1982.     $kill        some of the kill register        (read only)
  1983.     $lastkey    last keyboard char struck
  1984.     $line        text of current line
  1985.     $llength    length of current line            (read only)
  1986.     $match        last matched magic pattern        (read only)
  1987.     $mode        current mode ("command","insert","overwrite") (rd. o.)
  1988.     $modeline-format format of mode lines.  see "Mode line customization".
  1989.     $modified    is current buffer modified or not?
  1990.     $ntildes    percent of window filled by ~ chars, at end of buffer
  1991.     $ocwd        previous directory            (read only)
  1992.     $os        operating system ("unix", "dos", "vms", "os/2") (rd. o.)
  1993.     $pagelen    number of screen lines in use by editor
  1994.     $pagewid    current screen width
  1995.     $palette    current palette string
  1996.     $pathname    current path-like word
  1997.     $pending    typeahead pending flag            (read only)
  1998.     $pid        returns vile's process-id
  1999.     $progname    returns "vile" or "xvile". (read-only)
  2000.     $qidentifier    current qualified name (as with C++ ::)
  2001.     $read-hook    name of procedure to run after a file is read
  2002.     $replace    replacement pattern
  2003.     $search        search pattern
  2004.     $seed        current random number seed
  2005.     $shell        name of the shell program for spawned commands.
  2006.     $sres        current screen resolution
  2007.     $status        returns the status of the last command
  2008.     $title        current window title (X11 version only)
  2009.     $tpause        length to pause for paren matching (PC versions)
  2010.     $version    current version number            (read-only)
  2011.     $wline        number of lines in current window
  2012.     $word        current "word"
  2013.     $write-hook    name of procedure to run before a file is written
  2014.  
  2015.     In addition to the environment variables, you may set and use the
  2016.     values of the editor modes (i.e., universal modes, buffer-only modes or
  2017.     window-only modes), e.g., "setv $dos=true".  The global values of the
  2018.     editor modes are not visible to the expression evaluator.
  2019.  
  2020.     User-defined variables can also be set and used; their names are
  2021.     prefixed with the '%' character.
  2022.  
  2023.     Response variables (a '@' followed by a prompt-string) cause vile to
  2024.     prompt for input with the given prompt-string.
  2025.  
  2026.     Buffer variables (a '<' followed by a buffer name) return the current
  2027.     line of the specified buffer, automatically setting the position to the
  2028.     next line.
  2029.  
  2030.     Functions
  2031.     ---------
  2032.     There are also functions available, which can act on those variables,
  2033.     or on hard-coded values.  Operations are expressed in prefix notation,
  2034.     so to add to numbers you would say "&add 3 5".
  2035.  
  2036.     func    no. of
  2037.     name    args
  2038.     --------------
  2039.     &add    2    add two numbers together
  2040.     &sub    2    subtraction
  2041.     &tim    2    multiplication
  2042.     &div    2    division
  2043.     &mod    2    modulus
  2044.     &neg    1    negate
  2045.     &cat    2    concatenate string
  2046.     &lef    2    left string(string, len)
  2047.     &rig    2    right string(string, pos)
  2048.     &mid    3    mid string(string, pos, len)
  2049.     ¬    1    logical not
  2050.     &equ    2    logical equality
  2051.     &les    2    logical less than
  2052.     &gre    2    logical greater than
  2053.     &seq    2    string logical equality check
  2054.     &sle    2    string logical less than
  2055.     &sgr    2    string logical greater than
  2056.     &ind    1    evaluate indirect value
  2057.     &and    2    logical and
  2058.     &or     2    logical or
  2059.     &len    1    string length
  2060.     &upp    1    uppercase string
  2061.     &low    1    lower case string
  2062.     &tri    1    trim whitespace from string
  2063.     &tru    1    Truth of the universe logical test
  2064.     &asc    1    char to integer conversion
  2065.     &chr    1    integer to char conversion
  2066.     >k    0    get 1 character
  2067.     &rnd    1    get a random number from 1 to n
  2068.     &abs    1    absolute value of a number
  2069.     &sin    2    find the index of second string in first
  2070.     &env    1    retrieve a system environment variable
  2071.     &bin    1    lookup what function name is bound to key
  2072.     &rd    1    is a file readable
  2073.     &wr    1    is a file writable
  2074.     &glo    1    retrieves global mode setting
  2075.     &loc    1    retrieves local mode setting
  2076.  
  2077.  
  2078.     Directives
  2079.     ----------
  2080.     Primitive flow-of-control within a macro may be obtained with
  2081.     certain directives.  Macro directives start with a "~" and include
  2082.     the following:  (see the file macros.doc for more detail)
  2083.  
  2084.     ~if cond    conditional execution
  2085.     ~elseif cond    conditional execution
  2086.     ~else
  2087.     ~endif
  2088.     ~return        Return (terminating current macro)
  2089.     ~goto label    Jump to a label in the current macro
  2090.     ~force        Force macro to continue...even if command fails
  2091.     ~while cond    Execute a loop if the condition is true
  2092.     ~break
  2093.     ~endwhile
  2094.  
  2095.     ~endm        End a macro
  2096.  
  2097.     Line Labels begin with a "*" as the first nonblank char, like:
  2098.  
  2099.     *LBL01
  2100.  
  2101.     (you would jump to this with:
  2102.         ~goto LBL01
  2103.     )
  2104.  
  2105.     Lines ending with '\' are joined before interpreting them.
  2106.  
  2107.     Procedures vs. Macros
  2108.     ---------------------
  2109.     Macros are really just a special use of stored "procedures", which
  2110.     are, in turn, really just a special "type" of buffer.  To execute
  2111.     the contents of a buffer, it needs to have a name of the form
  2112.     "[buffername]".  Then, it can be executed as a procedure with the
  2113.     "run" command, as in "run buffername".  The best way to get
  2114.     procedures into buffers named that way (and also to make them
  2115.     invisible, so they don't clutter the buffer list) is to use
  2116.     the "store-procedure" command:
  2117.  
  2118.         store-procedure my_cd_action
  2119.         write-message &cat &cat &cat "moved from " $ocwd " to " $cwd
  2120.         ~if &seq $progname "xvile"
  2121.             set title $cwd
  2122.         ~endif
  2123.         ~endm
  2124.  
  2125.     Macros are a special usage of procedures, which are bindable to
  2126.     keystrokes (i.e. if procedures could be bound directly to keys,
  2127.     then macros would be redundant).  When the "9 store-macro" command
  2128.     is used, it creates a procedure whose name is [Macro 9], where 9
  2129.     is the argument to "store-macro".  This can then be executed
  2130.     with either
  2131.         run "Macro 9"
  2132.     or
  2133.         execute-macro-9
  2134.     Most of the examples given below use the macro form of definition,
  2135.     since one most often wants to bind macros to keys.
  2136.  
  2137.     Hooks
  2138.     -----
  2139.     There are a few places within vile where a user-specifiable
  2140.     procedure will be executed if desired.  These points are referred
  2141.     to as "hooks".  Hooks are specified by special variables which
  2142.     hold the name of a procedure to run at that point in the code.
  2143.     For instance, there is a "cd-hook", which is run when you change
  2144.     directories.  So, using the "my_cd_action" example given above,
  2145.     if the line
  2146.         set cd-hook my_cd_action
  2147.     is added, then that procedure will print a message and, under
  2148.     xvile, change the window title when the current directory is
  2149.     changed.
  2150.  
  2151.     The following hooks are currently implemented:
  2152.     $buffer-hook    run when switching to a buffer
  2153.     $cd-hook    run when changing directories
  2154.     $exit-hook    run when quitting
  2155.     $read-hook    run after a file is read
  2156.     $write-hook    run before a file is written
  2157.  
  2158.     Be careful with "buffer-hook".  Executing commands in the hook
  2159.     which themselves switch buffers is not recommended.  In general,
  2160.     all the hooks are a little dangerous, since vile has not been
  2161.     written with re-entrancy foremost in mind.  One should avoid putting
  2162.     actions in hooks which might cause the hook to be re-executed.
  2163.     (vile keeps the hook procedure itself from being re-executed, to
  2164.     prevent recursion, but the code surrounding the call to it may not
  2165.     be safe either.)
  2166.  
  2167.     Macro examples
  2168.     --------------
  2169.     To prevent vile from thinking that a failed command is an error in
  2170.     the macro, you can put "~force" in front of it.  So, to write a
  2171.     macro which will run the "man" command on the identifier under the
  2172.     cursor, where you don't really consider it an error if the command
  2173.     fails, you might use:
  2174.  
  2175.         9 store-macro
  2176.             ~force 1 shell-command &cat "man " $identifier
  2177.         ~endm
  2178.         bind-key execute-macro-9 ^X-m
  2179.  
  2180.     (The argument '1' suppresses the "press return" prompt which
  2181.     normally appears after a command runs, since man runs a pager
  2182.     which does this anyway.)
  2183.  
  2184.     The "screen-search-forward" command could be re-implemented as:
  2185.         10 store-macro
  2186.             ~force search-forward $identifier
  2187.         ~endm
  2188.         bind-key execute-macro-10 ^X-/
  2189.  
  2190.     And the "screen-search-pattern-grab" command, normally bound to
  2191.     ^A-/, could be implemented with:
  2192.         11 store-macro
  2193.             set-variable $search $identifier
  2194.             write-message &cat "Search pattern is now " $search
  2195.         ~endm
  2196.         bind-key execute-macro-11 ^A-/
  2197.  
  2198.     A variation, which will not find the identifier if it is a substring
  2199.     of another word, is:
  2200.         12 store-macro
  2201.             ~force search-forward &cat "\\<" &cat $identifier "\\>"
  2202.         ~endm
  2203.     This works by surrounding the string with the \< and \> regular
  2204.     expression metacharacters.
  2205.  
  2206.  
  2207.     Here's another example, which finds C++ qualified identifiers, and
  2208.     uses them for a tag lookup:
  2209.         * Implement  ^A-^] for qualified-name tag lookup
  2210.         24 store-macro
  2211.             backward-character
  2212.             set-variable %osearch $search
  2213.             search-forward "^[a-zA-Z_][a-zA-Z0-9_:]*"
  2214.             set-variable $search %osearch
  2215.             set-variable %osearch ""
  2216.             write-message &cat "Tag pattern is now " $match
  2217.             ~force find-tag $match
  2218.         ~endm
  2219.         bind-key execute-macro-24 ^A-^]
  2220.     (The "backward-character" is needed because "search-forward" will
  2221.     always skip the cursor position when scanning, so as to always find
  2222.     the next occurrence.  The user variable %osearch is used so as not
  2223.     to disturb the search string.)
  2224.  
  2225.     Note that for simple key-remappings, binding is often preferable
  2226.     to creating a macro.  Some people prefer using lower-case 'g' to
  2227.     as an equivalent to 'G', to goto a specific line.  If done as a
  2228.     macro, like this:
  2229.  
  2230.         3 store-macro
  2231.             goto-line
  2232.         ~endm
  2233.         bind-key execute-macro-3 g
  2234.  
  2235.     then both g and G go to the end of the file, but whereas 1000G goes
  2236.     to line 1000, 1000g goes to the end of the file 1000 times.  It is
  2237.     easier (and more correct) to do:
  2238.  
  2239.         bind-key goto-line g
  2240.  
  2241.     A couple more examples of slightly more complex macros:
  2242.     They cause a jump to the next (or previous) line of the same (or
  2243.     lesser) indent, skipping over empty lines.  (Thanks to MIURA Masahiro)
  2244.  
  2245.     ; macro 1 - back to the line of same indent
  2246.     ;
  2247.     1 store-macro
  2248.         first-nonwhite
  2249.         set-variable %indlev $curcol
  2250.         ~force back-line-at-bol
  2251.         ~if &seq &trim $line ""
  2252.             ~goto L1
  2253.         ~endif
  2254.         ~while &les %indlev $curcol
  2255.             *L1
  2256.             ~force back-line-at-bol
  2257.             ~if &seq $status "FALSE"
  2258.                 ~return
  2259.             ~endif
  2260.             ~if &seq &trim $line ""
  2261.                 ~goto L1
  2262.             ~endif
  2263.         ~endwhile
  2264.     ~endm
  2265.     bind-key execute-macro-1 ^X-[
  2266.  
  2267.     ; macro 2 - forward to the line of same indent
  2268.     ;
  2269.     2 store-macro
  2270.         first-nonwhite
  2271.         set-variable %indlev $curcol
  2272.         ~force down-line-at-bol
  2273.         ~if &seq &trim $line ""
  2274.             ~goto L2
  2275.         ~endif
  2276.         ~while &les %indlev $curcol
  2277.             *L2
  2278.             ~force down-line-at-bol
  2279.             ~if &seq $status "FALSE"
  2280.                 ~return
  2281.             ~endif
  2282.             ~if &seq &trim $line ""
  2283.                 ~goto L2
  2284.             ~endif
  2285.         ~endwhile
  2286.     ~endm
  2287.     bind-key execute-macro-2 ^X-]
  2288.  
  2289.     ; macro 14 - grep for the word under the cursor, and put the result
  2290.     ;    in a buffer named after that word.  set the error-buffer,
  2291.     ;    so that ^X-^X may be used to visit the lines found by grep.
  2292.     ;    (we have to set error-buffer explicitly, since we renamed
  2293.     ;    the buffer -- otherwise it tracks the last pipe read by vile)
  2294.     14 store-macro
  2295.         set-variable %grepfor $identifier
  2296.         edit-file &cat "!egrep -n " &cat %grepfor " *.[chs]"
  2297.         rename-buffer %grepfor
  2298.         error-buffer %grepfor
  2299.     ~endm
  2300.     bind-key execute-macro-14 ^A-g
  2301.  
  2302.     As a hint, it is (almost?) never correct to write a ':' command
  2303.     when creating a programmed macro.  For instance, if you find
  2304.     yourself writing something like:
  2305.  
  2306.         &cat ":!chmod +w " $cfilname
  2307.         &cat ":e! " $cfilname
  2308.  
  2309.     (in an attempt to make a buffer writable before editing it), then
  2310.     what you really want is:
  2311.  
  2312.         shell-command &cat "chmod +w " $cfilname
  2313.         replace-with-file $cfilname
  2314.  
  2315.     Furthermore, some things are just as easy if done with a
  2316.     "keystroke" macro rather than a programmed macro:
  2317.  
  2318.         ; use this as '@w'
  2319.         use-register w load-register ":!chmod +w %^M:setl noview^M:w^M"
  2320.  
  2321.     or
  2322.  
  2323.         map ^A-w ":!chmod +w %^M:setl noview^M:w^M"
  2324.  
  2325.     (Of course you need to replace the ^M's with real carriage-returns.)
  2326.  
  2327.     Picture Mode
  2328.     ------------
  2329.     Another example of a fairly complex vile procedure can be found
  2330.     in the file "pictmode.rc".  The code there implements a primitive
  2331.     means of drawing "ASCII art":
  2332.  
  2333.         o----------------------------------------o
  2334.            /----------------------------------------/|
  2335.           o----------------------------------------o||
  2336.           | To use it, first ":source pictmode.rc" |||
  2337.           | and then "run pic".  See the comments  |||
  2338.           | at the top of pictmode.rc for more     ||o
  2339.           | information...                   |/
  2340.           o----------------------------------------o
  2341.  
  2342. Regular Expressions
  2343. -------------------
  2344.  
  2345.     Searches use regular expressions, which, as in vi, may be magic
  2346.     by default or not.
  2347.  
  2348.     vile introduces some new magic metacharacters.
  2349.  
  2350.     The code that implements the expressions is based directly on
  2351.     Henry Spencer's regexp code.  Quoting from the original man page:
  2352.  
  2353.     [For ease of reference, the metacharacters are noted in the margin.)
  2354.  
  2355.    \|    "A regular expression is zero or more branches, separated by `\|'.
  2356.     It matches anything that matches one of the branches."
  2357.  
  2358.     "A branch is zero or more pieces, concatenated.  It matches a match
  2359.     for the first, followed by a match for the second, etc."
  2360.  
  2361.     "A piece is an atom possibly followed by `*', `\+', or `\?'.  An atom
  2362.    *    followed by `*' matches a sequence of 0 or more matches of the
  2363.    +    atom.  An atom followed by `\+' matches a sequence of 1 or more
  2364.    \?    matches of the atom.  An atom followed by `\?' matches a match of
  2365.     the atom, or the null string." [i.e., `\?' matches 0 or 1 occurrences]
  2366.  
  2367.  \( \)    "An atom is a regular expression in backslashed parentheses
  2368.     (matching a match for the regular expression), a range (see below),
  2369.   . ^    `.' (matching any single character), `^' (matching the null string
  2370.    $    at the beginning of the input string), `$' (matching the null
  2371.    \c    string at the end of the input string), a `\' followed by a single
  2372.    c    character (matching that character), or a single character with no
  2373.     other significance (matching that character)."
  2374.  
  2375.  \< \>    In addition, vile atoms may be: \< and \>, which match the
  2376.  \s \S    beginning and end of a "word", \s and \S, which match characters of
  2377.  \w \W    whitespace and "darkspace", \w and \W, which match alphanumerics
  2378.  \d \D    (including '_') and non-alphanumerics, \d and \D, which match
  2379.  \p \P    digits and non-digits, and \p and \P, which match printable and
  2380.     non-printable characters (whitespace is printable).
  2381.  
  2382.  [ ]    "A range is a sequence of characters enclosed in `[]'.  It normally
  2383.     matches any single character from the sequence.  If the sequence
  2384.     begins with `^', it matches any single character not from the
  2385.     rest of the sequence.  If two characters in the sequence are
  2386.     separated by `-', this is shorthand for the full list of ASCII
  2387.     characters between them (e.g.  `[0-9]' matches any decimal digit).
  2388.     To include a literal `]' in the sequence, make it the first
  2389.     character (following a possible `^').  To include a literal `-',
  2390.     make it the first or last character."
  2391.  
  2392.     Additionally for vile, if "ignorecase" is set, then all literal
  2393.     matches, including those in character classes, are done without
  2394.     regard to upper and lower case.
  2395.  
  2396.     In magic mode, the following set of metacharacters
  2397.     must be preceded by '\' to hide their special meaning:
  2398.         * [ . ^ $
  2399.     These characters are special if they _are_ preceded with a '\':
  2400.         ? + ( ) | < >
  2401.  
  2402.     If magic mode is _not_ on, only ^ and $ are special if not escaped.
  2403.     All of the following must be preceded with a '\' to be special,
  2404.     otherwise they are taken literally:
  2405.         ? + ( ) | * [ . < >
  2406.  
  2407.     Replacement subexpressions are supported when substituting.  That
  2408.     is, if part of an expression is contained in \( and \), then the
  2409.     part of the matched text in between those symbols will be
  2410.  \1 \9    substituted for an occurrence of \1 in the replacement pattern.  Up
  2411.     to 9 such substitutions can be made.  The special symbol & will
  2412.   &    substitute for the entire match string.
  2413.  
  2414.   ~    The tilde (~) character will expand immediately when it is typed
  2415.     to be the contents of the previously entered replacement pattern.
  2416.     [ Earlier versions of vile made this version of the pattern
  2417.     available immediately, as a default response, but this made it
  2418.     difficult to substitute nothing after previously substituting
  2419.     something.  ]
  2420.  
  2421.     The replacement part of the substitution may also contain the
  2422.  \U \L    special sequences \U and \L, which cause the replacement to be
  2423.  \E    forced to uppercase or lowercase until a terminating \E is found;
  2424.  \u \l    \u and \l, which force the case of a single character; and \b,
  2425.  \bfrtn    \f, \r, \t, \n, which insert the usual ASCII character.
  2426.     Note that vile mimics perl's handling of \u\L\1\E instead of vi's.
  2427.     Given :s/\(abc\)/\u\L\1\E/ vi will replace with "abc" whereas vile
  2428.     and perl will replace with "Abc".  This is somewhat more useful for
  2429.     capitalizing words.
  2430.  
  2431. Command files
  2432. -------------
  2433.  
  2434.     On startup (in the absence of '@' arguments -- see Invocation
  2435.     below), vile will attempt to read the file ".vilerc" in the current
  2436.     directory, and then in $HOME, and will execute the commands found
  2437.     therein.  [This file is called "vile.rc" under DOS, and is searched
  2438.     for in the current directory and along the PATH.]  It is possible to
  2439.     nest such executions.  For example, you might keep your general
  2440.     default settings in your home directory, and put the following
  2441.     lines in a .vilerc in a directory in which you prefer tabs be set
  2442.     to 4 spaces:
  2443.  
  2444.         source "$HOME/.vilerc"
  2445.         set tabstop 8
  2446.  
  2447.     The quotes surrounding the filename are necessary to protect the
  2448.     name from interpretation as a vile variable, since it starts with
  2449.     the '$' character.
  2450.  
  2451.     Files can be executed at any time with the ":source" (or
  2452.     ":execute-file") command.  There are control structures available,
  2453.     such as ~while, ~if, etc.  Refer to the file macros.doc which
  2454.     is distributed with vile for more information.
  2455.  
  2456.     Nesting of source'd files is limited to a depth of ten, to prevent
  2457.     infinite recursion.
  2458.  
  2459.     The ';' character can be used as a comment character in command
  2460.     files, but not necessarily on the same line as valid commands.  Put
  2461.     your comments on separate lines to be safe.
  2462.  
  2463. Invocation
  2464. ----------
  2465.  
  2466.     As mentioned above, vile normally looks for files called "./.vilerc"
  2467.     and "$HOME/.vilerc", and executes the first one found.  If the
  2468.     variable VILEINIT is set in the environment, it is used as a set of
  2469.     vile commands to initialize the editor.  As a not-very-useful
  2470.     example of a VILEINIT sequence, the following setting will exactly
  2471.     recreate the default (i.e. no VILEINIT variable) behavior:
  2472.  
  2473.         export VILEINIT
  2474.         VILEINIT="
  2475.         ~if &rd \"./.vilerc\"
  2476.             source \"./.vilerc\"
  2477.         ~else
  2478.             ~if &rd \"$HOME/.vilerc\"
  2479.                 source \"$HOME/.vilerc\"
  2480.             ~endif
  2481.         ~endif"
  2482.  
  2483.     Other environment variables:
  2484.  
  2485.     VILE_HELP_FILE
  2486.         override the name of the help file, normally "vile.hlp".
  2487.     VILE_STARTUP_FILE
  2488.         override the name of the startup file, normally ".vilerc"
  2489.         (or "vile.rc" for non-UNIX systems).
  2490.     VILE_STARTUP_PATH
  2491.         override the search path for the startup and help files.
  2492.  
  2493.  
  2494.     Command line options
  2495.     --------------------
  2496.     The command line options are fairly straightforward.  vile does not
  2497.     support running just _any_ command after a '+', as does vi, but does
  2498.     support the commonly used '+400' to go to line 400 and '+/foo' to
  2499.     search for foo.  Command files can be explicitly executed on
  2500.     startup by prefixing them with the '@' character, as in "vile
  2501.     @mycmds file.c".  This will suppress the operation of VILEINIT and
  2502.     the .vilerc files.
  2503.  
  2504.     Use "vile -?" to get the usage message.
  2505.  
  2506.     +NNN and -gNNN  vile will begin the session on the first file
  2507.         at the specified line number.
  2508.  
  2509.     +/pattern or -s pattern   In the first file, vile will execute an
  2510.         initial search for the given pattern.
  2511.  
  2512.     -t tag  vile will edit the correct file and move the cursor
  2513.         to the location of the tag.  This requires a tagsfile
  2514.         created with the ctags(1) command.
  2515.  
  2516.     -h      Invokes vile on the helpfile.
  2517.  
  2518.     -v    Invokes vile in "view" mode - no changes are permitted
  2519.         to the buffer in this mode.  (This will also be true if
  2520.         vile is invoked as view.)
  2521.  
  2522.     -V    vile will report its version number.
  2523.  
  2524.     @cmdfile   vile will run the specified file as its startup
  2525.         file, and will bypass any normal startup file (i.e.
  2526.         .vilerc) or environment variable (i.e. $VILEINIT).
  2527.  
  2528. Crash Recovery
  2529. --------------
  2530.  
  2531.     The "vi -r" option, used to recover an edited buffer after a system
  2532.     crash, is not present in vile.  If vile itself crashes (usually
  2533.     (though infrequently :-) due to a bug, but perhaps due to an
  2534.     externally applied signal), it will attempt to save any modified
  2535.     buffers in a directory under /tmp, and send mail to the user to
  2536.     that affect.  If system crashes are frequent on your system, you
  2537.     should stop using it.  You might also consider the "autosave" and
  2538.     "autowrite" options, which will cause more frequent saves of your
  2539.     work.
  2540.  
  2541.  
  2542. Mode line customization
  2543. -----------------------
  2544.  
  2545.     At the bottom of each window is a mode (or "status") line which
  2546.     is used for displaying certain characteristics of the window and
  2547.     the buffer associated with it.  On most displays, this mode line
  2548.     will be highlighted in reverse video or via other means in order
  2549.     to visually separate windows and to distinguish the mode line from
  2550.     text displayed in the window.
  2551.  
  2552.     The editor variable "modeline-format" is set to a string which
  2553.     controls formatting of mode lines.  This variable is user settable and
  2554.     thus may be used to customize the display of mode lines.  The
  2555.     format specifiers which may appear in the format control strings
  2556.     are as follows:
  2557.  
  2558.         %i     insert/overwrite/replace mode indicator, displayed
  2559.             only when in insert, overwrite, or replace mode.
  2560.             When not in one of these modes, the separator
  2561.             character (often "-", "=", or " ") will be displayed.
  2562.         %b    buffer name
  2563.         %f    file name when not internal buffer and when not the
  2564.             same as the buffer name.
  2565.         %F    internal buffer name
  2566.         %m    major mode(s), e.g, cmode, view-only, etc.  Displayed
  2567.             in square brackets.
  2568.         %l    line number to be displayed if "ruler" is set
  2569.         %c    column number if "ruler" is set
  2570.         %p    line number as percentage of number of lines if
  2571.             "ruler" is set
  2572.         %S    rough position of window with respect to buffer (top,
  2573.             bot, all, emp, mid) when ruler not set (or ruler is
  2574.             set, but buffer is empty).
  2575.         %L    number of lines in buffer, if ruler is set
  2576.         %=    middle separator; should appear at most once in a
  2577.             format string.  This indicates where to separate the
  2578.             left and right hand portions of the mode line with a
  2579.             long string of dashes (or whatever the separator
  2580.             character is).
  2581.         %-    single occurrence of separator character
  2582.         %|    eighty column indicator
  2583.         %%    percent sign
  2584.         %:    colon
  2585.  
  2586.     Some of the format specifiers (%f, %F, %m, %l, %c, %p, %S, %L) are
  2587.     conditionally displayed.  For example "%m" will display the major
  2588.     modes only if there are some major modes set or if the buffer has
  2589.     been modified (which is sort of a major mode).  Similarly, "%F" and
  2590.     "%f" will cause the associated file name to be displayed when the
  2591.     buffer is of the appropriate type (a scratch buffer or not) and the
  2592.     shortened file name is different from the buffer name.  It is
  2593.     desirable at times to cause a prefix string and/or a suffix string
  2594.     to be emitted along with the string obtained after conversion of
  2595.     the format specifier.  This may be done by following the format
  2596.     specifier with a colon, the prefix string, another colon, the
  2597.     suffix string, and another colon.  For example, "%l:(:,:%c::) :"
  2598.     might be used to display the line and column number for "ruler"
  2599.     mode.  Note that either or both of the prefix and suffix strings
  2600.     may be empty.
  2601.  
  2602.     Characters in the string which are not part of a format specifier
  2603.     are output verbatim.
  2604.  
  2605.     The default format control string is as follows:
  2606.  
  2607.         "%-%i%- %b %m:: :%f:is : :%=%F: : :%l:(:,:%c::) :%p::% :%S%-%-%|"
  2608.  
  2609.     Mode lines for some versions of vile previous to version 4.7 can be
  2610.     obtained with the following format string.  This will remove the
  2611.     percentage indication from the mode line when in ruler mode and
  2612.     also shift the ruler indicator to the far right in the mode line.
  2613.  
  2614.         "%-%i%- %b %m:: :%f:is : :%=%F: : %-%-%-%-:%l:(:,:%c::):%S::%-%-:%|"
  2615.  
  2616. Filtering "man" pages
  2617. ---------------------
  2618.  
  2619.     When used in conjunction with the vile-manfilt program (supplied as
  2620.     source file "manfilt.c"), either vile or xvile may be used to filter
  2621.     and view manual pages.  xvile will even display (with your font set
  2622.     properly) certain portions of the manual page text in bold or
  2623.     italics as appropriate.
  2624.  
  2625.     The file manpage.rc (found in the vile source directory, and also
  2626.     copied below) contains a macro which is bound to ^X-m.  It will
  2627.     prompt for a manual page, filter it, attach attributes and display
  2628.     it in the current window.  The text of manpage.rc may be either
  2629.     incorporated verbatim into your .vilerc file or may be read from
  2630.     your .vilerc as follows:
  2631.  
  2632.         source ~/manpage.rc
  2633.  
  2634.     This assumes that you have moved the manpage.rc file to your home
  2635.     directory.  If you do all of this but use vile rather than xvile,
  2636.     you will still end up with a legible man page, albeit without the
  2637.     spiffy formatting.
  2638.  
  2639.     The manual page filtering program may also be used to look at other
  2640.     text formatted with nroff.  From the vile source directory, for
  2641.     example, the following command will format and filter the vile
  2642.     manual page (which is nroff source).
  2643.  
  2644.         :e !nroff -man vile.1 | vile-manfilt
  2645.  
  2646.     Once loaded, it will look rather funny.  There will be Cntl-A
  2647.     characters scattered throughout the text followed by a sequence of
  2648.     digits followed by one or more uppercase letters followed by a
  2649.     colon.  These Cntl-A sequences specify how the text following the
  2650.     colon should be attributed.  The vile command
  2651.     "attribute-cntl_a-sequences-til" (bound to ^A-A) may be used to
  2652.     format a region of text containing these sequences.  To continue our
  2653.     example, the following command will translate this representation of
  2654.     attributed text into one which is more pleasing to look at.
  2655.  
  2656.         ^A-AG
  2657.  
  2658.     Here is the macro from the file manpage.rc:
  2659.     ;;
  2660.     ;; Macros for obtaining manual pages and then attributing them.
  2661.     ;;
  2662.     ;; Author: Kevin Buettner
  2663.  
  2664.     29 store-macro
  2665.         set-variable %manpage @"man page? "
  2666.         ~if &or &seq %manpage "ERROR" & seq %manpage ""
  2667.             ~return
  2668.         ~endif
  2669.         set-variable %manpagebuf &cat "<" &cat %manpage ">"
  2670.         set terse
  2671.         ~force select-buffer %manpagebuf
  2672.         ~if ¬ $status
  2673.             edit-file &cat "!man " &cat %manpage " | vile-manfilt"
  2674.             ~force rename-buffer %manpagebuf
  2675.             ~force error-buffer %manpagebuf
  2676.             write-message "[Attaching attributes...]"
  2677.             goto-beginning-of-file
  2678.             setl noview
  2679.             attribute-cntl_a-sequences-til end-of-file
  2680.             unmark-buffer
  2681.             setl view
  2682.             goto-beginning-of-file
  2683.             write-message "[Done formatting manual page.]"
  2684.         ~endif
  2685.         set noterse
  2686.     ~endm
  2687.     bind-key execute-macro-29 ^X-m
  2688.  
  2689. Filtering C programs
  2690. --------------------
  2691.     C program text may be displayed with keywords and comments
  2692.     highlighted in a similar fashion to the man page filtering
  2693.     described above.  A filter which performs this is supplied with
  2694.     vile, and is called "vile-c-filt" (source is "c-filt.c").  Its use
  2695.     is described more fully in comments at the head of the source file.
  2696.     It doesn't provide what one would describe as "tightly integrated
  2697.     syntax coloring".  Its usefulness is limited by reliance on an
  2698.     external filter to do the coloring, and the fact that the filter
  2699.     interferes with the normal undo history of the buffer (since it
  2700.     must modify the buffer to do its work).  Nonetheless, it's an
  2701.     interesting adjunct to the editor.
  2702.  
  2703.     Here is a macro one might use to invoke the colorizer:
  2704.         30 store-macro
  2705.             write-message "[Attaching C/C++ attributes...]"
  2706.             set-variable %savcol $curcol
  2707.             set-variable %savline $curline
  2708.             set-variable %modified $modified
  2709.             goto-beginning-of-file
  2710.             filter-til end-of-file "vile-c-filt"
  2711.             goto-beginning-of-file
  2712.             attribute-cntl_a-sequences-til end-of-file
  2713.             ~if ¬ %modified
  2714.                 unmark-buffer
  2715.             ~endif
  2716.             %savline goto-line
  2717.             %savcol goto-column
  2718.             write-message "[Attaching C/C++ attributes...done ]"
  2719.         ~endm
  2720.         bind-key execute-macro-30 ^X-q
  2721.  
  2722.     The vile-c-filt program does its work based on the contents of
  2723.     $HOME/.vile.keywords, which contains a set of keyword/attribute
  2724.     pairs.  An example (and probably insufficient) .vile.keywords file
  2725.     might contain:
  2726.         Comments:B
  2727.         Literal:B
  2728.         Cpp:U
  2729.         if:C3
  2730.         else:C3
  2731.         for:C3
  2732.         while:C3
  2733.         do:C3
  2734.         typedef:I
  2735.         struct:I
  2736.     (The "Comments" keyword is a pseudo-keyword which determines the
  2737.     attribute given to C and C++ style comments.  "Literal" applies to
  2738.     string literals. "Cpp" applies to C preprocessor lines, e.g. #if,
  2739.     etc.)
  2740.  
  2741.     An alternative filter, written using "flex", is available in
  2742.     c-filt.flx.  It might suit your needs better, or be a better
  2743.     starting point for creating similar coloring mechanisms for other
  2744.     languages.
  2745.  
  2746. X Window System specifics
  2747. -------------------------
  2748.  
  2749.     If you are using xvile under X11, the following additions are
  2750.     available:
  2751.  
  2752.     Mouse buttons
  2753.     -------------
  2754.  
  2755.     1 -    Sets cursor position and the start of the selection when
  2756.         mouse pointer is positioned in any vile window (but not the
  2757.         message line).    Clicking on a mode line will set the
  2758.         keyboard focus to the corresponding vile window.  Double
  2759.         clicking on a mode line will do the above in addition to
  2760.         clearing the highlighting associated with the current
  2761.         selection.
  2762.  
  2763.         Selections may be made by holding button one down and
  2764.         "wiping" with the mouse.  Release of the mouse button will
  2765.         cause the selection to be yanked and made available (if
  2766.         desired) for pasting.  The region selected may be forced to
  2767.         be rectangular by holding the control key down while wiping
  2768.         with button one depressed.  If the wiping motion goes out of
  2769.         the current window, text will be scrolled in the appropriate
  2770.         direction if possible to accommodate selections larger than
  2771.         the window.  The speed at which the scrolling occurs will
  2772.         increase with the passage of time making it practical to
  2773.         select large regions of text quickly.
  2774.  
  2775.         Individual words or lines may be selected by double or
  2776.         triple clicking.
  2777.  
  2778.     2 -    Paste the current PRIMARY selection.  With a shift modifier,
  2779.         it pastes at the mouse position, otherwise it pastes at
  2780.         the last text cursor position before selecting.
  2781.  
  2782.     3 -    Extend the current selection.  As with button one, the
  2783.         selection may be adjusted or scrolled by holding down button
  2784.         three and wiping with it.  Selections may be extended in any
  2785.         window open to the same buffer as which the selection was
  2786.         started in.
  2787.  
  2788.     [ As described below in the "Scrollbars" section, the buttons
  2789.     are modified by the control key as follows, when used on a scrollbar:
  2790.  
  2791.     Ctrl-Button-1 splits the clicked-on window into two windows.
  2792.     Ctrl-Button-2 deletes the clicked-on window.
  2793.     Ctrl-Button-3 makes the clicked-on window the only window. ]
  2794.  
  2795.  
  2796.     Areas of selected text can be operated on with any vile operator
  2797.     command, in conjunction with the special "motion" command '^S',
  2798.     which applies the operator to the selected region.  For example,
  2799.     after selecting text with the mouse, it can be converted to
  2800.     uppercase with ^A-u^S.    Remember that some operators (e.g. the
  2801.     shell-filtering operator, '!') are only capable of working on full
  2802.     lines of text.
  2803.  
  2804.     Scrollbars
  2805.     ----------
  2806.  
  2807.     The X toolkit version of xvile provides default translations
  2808.     similar to the translations for scrollbars found in the Athena
  2809.     widget set.  (If you know how to use xterm's scrollbars, you know
  2810.     how to use these scrollbars.)  Button one scrolls forward.  Button
  2811.     three scrolls backward.  The amount of scrolling obtained by these
  2812.     buttons depends on the position at which they were pressed on the
  2813.     scrollbar.  Clicking near the top of the scrollbar will scroll the
  2814.     text by a small amount which may be as little as one line.
  2815.     Clicking in the middle will scroll by about half a page.  Clicking
  2816.     near the bottom will scroll by a larger amount up to a whole page.
  2817.     Holding either one of these buttons down will cause repeated
  2818.     scrolling.
  2819.  
  2820.     If simply pressed and released, button two will set the position in
  2821.     the buffer to a position proportional to the location of the
  2822.     pointer on the scroll bar.  Button two may be held down to "drag"
  2823.     the slider from one place to another causing text to scroll
  2824.     continuously.
  2825.  
  2826.     The Motif and OpenLook versions provide scrollbars from their
  2827.     respective widget sets.  Both versions have a slider indicating the
  2828.     position of the window over the buffer.  OpenLook's slider is fixed
  2829.     in size with little arrows at the top and bottom of the slider.
  2830.     Pressing on one of these arrows will cause scrolling in the
  2831.     appropriate direction.    The slider may be "grabbed" and moved by
  2832.     pressing and dragging the middle portion between the arrows.
  2833.     Motif's slider is solid with size varying to indicate the size of
  2834.     the window with respect to the size of the buffer.  Any portion of
  2835.     it may be grabbed for movement.  There are little arrows at the top
  2836.     and bottom of the scroll bar which may be clicked upon to cause
  2837.     scrolling by one line.    In both of these widget sets, clicking on
  2838.     the scrollbar either above or below the slider will cause scrolling
  2839.     by a full page.  OpenLook has two additional control areas; the
  2840.     buffer position may be set to either the beginning or end of the
  2841.     buffer by pressing on one of the little rectangular areas at either
  2842.     the top or bottom of the scrollbar.
  2843.  
  2844.     In all versions built with scrollbars enabled, you can resize
  2845.     windows by moving the border between corresponding scrollbars (with
  2846.     the mouse).  The X toolkit version is probably the most functional,
  2847.     with the windows being continuously resized as the mouse is moved.
  2848.     The OpenLook and Motif versions wait until after a position is
  2849.     selected to resize the windows.  The OpenLook version is perhaps
  2850.     the least functional; there is no visible indication (other than
  2851.     the position of the mouse pointer) to indicate where the new border
  2852.     will be.
  2853.  
  2854.     Splitting and deleting of windows may also be done with the mouse.
  2855.     In each case the action is selected by pressing one of the mouse
  2856.     buttons over a scrollbar with the control key held down.  Button
  2857.     one (with the control key held down) will split the scrollbar and
  2858.     the corresponding vile window with the new border at or near the
  2859.     mouse cursor.  Button two (with control key) will delete the
  2860.     scrollbar and corresponding window.  Button three (with control
  2861.     key) will make the corresponding window the only window.
  2862.  
  2863.     Standard X command line arguments
  2864.     ---------------------------------
  2865.  
  2866.     -fn fontname    Font to use (or -font).
  2867.     -rv        Use reverse video (also -reverse).
  2868.     +rv        Don't use reverse video.
  2869.     -display disp    Display to run xvile on.
  2870.     -fg color    Foreground color (or -foreground).
  2871.     -bg color    Background color (or -background).
  2872.     -bd color    Border color (or -bordercolor).
  2873.     -name name    Name used for resource lookups.
  2874.     -title name    Name to be displayed in titlebar.
  2875.     -geometry geom    Initial window dimensions in columns and rows.
  2876.     -iconic     Start xvile iconified.
  2877.     -xrm Resource    Specify or change an X resource internal to xvile.
  2878.  
  2879.     Additional xvile command line arguments
  2880.     ---------------------------------------
  2881.  
  2882.     -leftbar    Put scrollbar(s) on left.
  2883.     -rightbar    Put scrollbar(s) on right (default).
  2884.  
  2885.     Setting a new process group
  2886.     ---------------------------
  2887.     Some systems and/or some shells and display managers seem to want
  2888.     xvile to run in its own process group, to help isolate its signals
  2889.     and actions from the signals and actions of the parent process
  2890.     (i.e. the shell or window manager that starts xvile).  xvile can
  2891.     be forced into its own process group with the "new-process-group"
  2892.     command, which one would put in the .vilerc file.  Using this will
  2893.     cause a call to "setpgrp()" or "setsid()".  This behavior is not
  2894.     the default because a) it can't be undone, and b) it seems
  2895.     undesirable on some systems, in that xvile cannot be suspended and
  2896.     put in the background after startup if it's in its own group.
  2897.  
  2898.     Additionally, if given a count as argument, this command will cause
  2899.     xvile to fork(), and the parent to exit before the new process
  2900.     group is set by the child.  This will further isolate it from its
  2901.     process environment (and in fact will move xvile into the background
  2902.     if started from the shell).
  2903.  
  2904.     The "new-process-group" command has no effect in non-X11 versions
  2905.     of vile.
  2906.  
  2907.  
  2908.     X Resources
  2909.     -----------
  2910.  
  2911.     font        Font to use.
  2912.  
  2913.     geometry    Window dimensions in characters.
  2914.  
  2915.     charClass    Character classes for multiple click selections.
  2916.             The format is identical to that of xterm(1).
  2917.  
  2918.     multiClickTime    How long between clicks (in milliseconds) to
  2919.             be accepted as a multi-click.
  2920.  
  2921.     foreground
  2922.     background    Foreground/Background color of the main xvile text
  2923.             area.
  2924.  
  2925.     cursor.foreground
  2926.     cursor.background   Foreground/Background color of the cursor.
  2927.             By default the cursor location is indicated by
  2928.             inverting the foreground and background colors of
  2929.             the cell the cursor is over.  Thus the color of the
  2930.             cursor will vary depending upon location.  Use of
  2931.             these subresources will cause the cursor to
  2932.             maintain constant coloration of the user's
  2933.             choosing, and may make it easier to see when it
  2934.             appears in a "highlighted" or "selected" area of
  2935.             text.
  2936.  
  2937.     modeline.focusForeground
  2938.     modeline.focusBackground   Foreground/Background color of the mode
  2939.             line corresponding to the window with focus, i.e.
  2940.             the "current" window.
  2941.  
  2942.     modeline.foreground
  2943.     modeline.background   Foreground/Background color of mode lines
  2944.             corresponding to windows without the keyboard
  2945.             focus.  modeline.background is also used for the
  2946.             scrollbar borders and resize grips.
  2947.  
  2948.     forkOnStartup    If true, xvile forks after initialization.
  2949.  
  2950.     focusFollowsMouse  If true, the "current" window is the window
  2951.             inhabited by the mouse; no clicking is necessary
  2952.             to change windows.
  2953.  
  2954.     pointer.foreground
  2955.     pointer.background   Foreground/Background color of the pointer.
  2956.  
  2957.     pointer.normalShape
  2958.     pointer.watchShape   Set the shapes for the normal and watch pointers
  2959.             respectively.
  2960.  
  2961.     scrollbarOnLeft Either true or false; control the placement of
  2962.             the scrollbars.  By default, scrollbars are placed
  2963.             on the right.
  2964.  
  2965.     scrollbarWidth    An integer indicating the width of the scrollbar.
  2966.  
  2967.     scrollbar.foreground
  2968.     scrollbar.background  Foreground/Background color of the slider or
  2969.             one of the colors of the slider if a stippled
  2970.             pixmap is used.  To force the slider to be only the
  2971.             foreground color, you should set sliderIsSolid to
  2972.             true.  (X toolkit version only)
  2973.  
  2974.     scrollbar.sliderIsSolid  If false, indicates that the stippled
  2975.             pixmap should be used to simulate grey.  This will
  2976.             be best on monochrome displays.  True works better
  2977.             for color displays.  True indicates the slider will
  2978.             be displayed in the foreground color, shaded to
  2979.             look three-dimensional, if possible.  (X toolkit
  2980.             version only)
  2981.  
  2982.     scrollRepeatTimeout  Amount of time in milliseconds to wait initially
  2983.             before repeating scroll when button one or three are
  2984.             held down. (X toolkit version only).
  2985.  
  2986.     scrollRepeatInterval  Amount of time to wait between repeating
  2987.             subsequent scrolls.   This parameter is also used
  2988.             for controlling the speed at which selections are
  2989.             scrolled.
  2990.  
  2991.     selection.foreground
  2992.     selection.background  Foreground/Background color of the selection
  2993.             regions.  "foreground" is the color that
  2994.             the text is displayed in.
  2995.  
  2996.     persistentSelections  If true (the default), highlighting of the
  2997.             selection will persist even when button one is
  2998.             pressed to set the cursor position.  A false value
  2999.             will behave more like other X applications in which
  3000.             display of the selection is lost as soon as button
  3001.             one is pressed.
  3002.  
  3003.     selectionSetsDOT  If false (the default), the cursor will be restored
  3004.             to its previous position prior to making the selection.
  3005.             If true, the cursor will be positioned at the location
  3006.             of the mouse at the end of making a selection (usually
  3007.             at either the start or end of a selection).
  3008.  
  3009.     blinkInterval    An integer indicating the time in milliseconds to wait
  3010.             before blinking the cursor.  A positive value will
  3011.             cause the cursor to always blink.  Setting
  3012.             blinkInterval to zero will cause the cursor to never
  3013.             blink which may be useful on some display servers
  3014.             connected to very slow networks.  The disadvantage
  3015.             of setting it to zero is that it is sometimes hard
  3016.             to tell where the cursor is when situated at the
  3017.             boundary of a highlighted region.  A negative value
  3018.             (which is the default) will cause the cursor to
  3019.             blink only when situated in a highlighted region
  3020.             such as a selection.  This will make the cursor
  3021.             visible no matter where it is.
  3022.  
  3023.     color.fcolor1,
  3024.     color.bcolor1, ...,
  3025.     color.fcolor15,
  3026.     color.bcolor15
  3027.             When doing text attribution with the
  3028.             "attribute-cntl_a-sequences-til" command (bound to
  3029.             ^A-A), the attribute may be of the form "Cn", where
  3030.             'n' is a hex digit.  This digit picks one of the 16
  3031.             fcolor/bcolor pairs set up in the color
  3032.             subresource.  For example, if the buffer contained
  3033.             the text:
  3034.                 ^A6C3:foobar
  3035.             then after the ^A-A command was applied, the leading
  3036.             "^A3C3:" would be gone, and the word "foobar" would
  3037.             appear in the foreground and background colors
  3038.             specified by color.fcolor3 and color.bcolor3.  Either
  3039.             of the pair can be left unspecified, and will default
  3040.             to the natural foreground or background color of
  3041.             normal text.
  3042.  
  3043.  
  3044.     Sample .Xdefault entries
  3045.     ------------------------
  3046.  
  3047.     You may or may not want to use the following as a starting point
  3048.     for the "XVile" section of your .Xdefaults or .Xresources file.  If
  3049.     you have a monochrome display server, you will probably not want
  3050.     to use any of the color specifications.  You may, however, wish
  3051.     to set up a blinking cursor, using "blinkInterval"  (see above).
  3052.  
  3053.     XVile*font: -*-courier-medium-r-normal-*-*-*-75-75-m-70-iso8859-*
  3054.     XVile*geometry:    80x54
  3055.     XVile.background: darkslategrey
  3056.     XVile.foreground: honeydew
  3057.     XVile.scrollbar.foreground: firebrick2
  3058.     XVile.scrollbar.sliderIsSolid: true
  3059.     XVile.selection.background: aquamarine4
  3060.     XVile.selection.foreground: honeydew
  3061.     XVile.cursor.background: yellow
  3062.     XVile.cursor.foreground: darkslategrey
  3063.     XVile.modeline.Background: steelblue
  3064.     XVile.modeline.foreground: darkslategrey
  3065.     XVile.modeline.focusForeground: yellow
  3066.  
  3067.     Fonts
  3068.     -----
  3069.  
  3070.     To change the font on the fly, use the ':setv' command to set the
  3071.     $font variable, with ":setv $font <fontname>".
  3072.  
  3073.     At present, only xvile is capable of displaying bold and italic (or
  3074.     underline) text associated with attributes.  It is anticipated that
  3075.     other versions of vile will catch up to the best of their ability.
  3076.     Users of xvile will find that the italic font in particular is not
  3077.     always available with the font that they've chosen (or have had
  3078.     chosen for them).  If an italic font is unavailable, xvile will
  3079.     underline text which is meant to be italic.  The program xfontsel is
  3080.     quite useful for determining which fonts are available on your
  3081.     display server and whether there are corresponding bold and/or
  3082.     italic fonts available.
  3083.  
  3084.     Here are some tips on using xfontsel to find an appropriate font.
  3085.  
  3086.         1) Set rgstry (registry) to iso8859
  3087.         2) Set spc (spacing) to either "c" (cell font) or "m"
  3088.            (monospaced font).  You will be more likely to find a
  3089.            font which will work as italic if you choose a
  3090.            monospaced font, however.  You definitely do not want
  3091.            a proportional font.
  3092.         3) Now pull down the slant menu.  Select either "i"
  3093.            (italic) or "o" (oblique).  If neither of these are
  3094.            available, go back to step 2 and choose a different
  3095.            spacing.
  3096.         4) Set avgWdth (average width) next. If you divide the
  3097.            value you've chosen by ten, this will be width of a
  3098.            glyph in the font in pixels.
  3099.         5) Set wght (weight) to medium.  If you have a hard time
  3100.            seeing the characters, you might want to choose bold,
  3101.            but xvile will not be able to use the bold font for
  3102.            displaying bold text.  It will be forced to overwrite
  3103.            text that it wants to be bold with the text shifted by
  3104.            one pixel.  This works fairly well for larger fonts.
  3105.         6) Set fmly (family) to a value according to personal taste.
  3106.            By this step, you might not have any choice on the matter
  3107.            anyway.
  3108.         7) If only one font is available at this point, the other
  3109.            fields don't matter that much.  Otherwise set these
  3110.            according to taste.
  3111.         8) Go back to the slant menu and change either the "i" or
  3112.            "o" to "r".
  3113.  
  3114.         This will be the font to use.  xvile will be attempt to get
  3115.         the italic font when needed by substituting either "o" or
  3116.         "i" for the "r".
  3117.  
  3118.     If the above seems too tedious, you can just try the following font
  3119.     which (on many display servers) is pretty close to the size of the
  3120.     default font that xvile will start up with.
  3121.  
  3122.         -*-courier-medium-r-*-*-*-*-*-*-*-70-*-*
  3123.  
  3124.     You can try it out by issuing the appropriate "set font" command
  3125.     from xvile.  For longer term use, you will probably want to put it
  3126.     in your .Xdefaults file.  It will look something like this:
  3127.  
  3128.         XVile*font: -*-courier-medium-r-*-*-*-*-*-*-*-70-*-*
  3129.  
  3130.     You may also set the font from your .vilerc file.  This is not
  3131.     recommended, however, as you lose the ability to choose a different
  3132.     font from the command line or resource file.  It may also cause the
  3133.     xvile window to be unnecessarily resized during initialization.
  3134.  
  3135.  
  3136.  
  3137.  
  3138. DOS specifics
  3139. -------------
  3140.  
  3141.     The .vilerc file is called vile.rc under DOS.
  3142.  
  3143.     vile is perfectly happy (and even tries very hard) to use the
  3144.     UNIX-style "forward-slash" ('/') as a path delimiter.  Entering the
  3145.     "backslash" ('\') will work, but you should be aware that vile uses
  3146.     this character as an escape mechanism for entering special
  3147.     characters (e.g. "\t" for TAB) in strings.  As an example setting
  3148.     "tags" to "tags ..\tags" will not have the intended result.
  3149.     Instead, use "tags ..\\tags" or better, "tags ../tags".
  3150.  
  3151.     vile should leave your screen in the mode you're in when you
  3152.     enter it, unless you explicitly change it to a different mode with
  3153.     a "set sres=" line in your vile.rc, or if you use a command line
  3154.     option to change it.  Command line options consist of a dash
  3155.     followed by one of the following selectors (these are the same
  3156.     values that can be assigned to "sres"):
  3157.         "default",
  3158.         "2",     "25",    "80x25",
  3159.         "4",     "43",    "80x43",
  3160.         "5",     "50",    "80x50",
  3161.         "80x14", "80x28",
  3162.         "40x12", "40x21", "40x25", "40x28", "40x50",
  3163.  
  3164.     [ Currently, under DOS, not all modes may work, as a result of
  3165.       the screen library being used... (in version 5.5).  More may
  3166.       work under OS/2. ]
  3167.  
  3168.     If you shell out in 50 line mode, make sure you are in 50 line mode
  3169.     before you exit the dos shell, otherwise you end up with a 50 line
  3170.     edit window with only the top 25 displayed.
  3171.  
  3172.     The vile.rc file can be located in the same directory as your
  3173.     binary executable, since vile searches the PATH for this file.
  3174.  
  3175.     All file globbing, including from the command line, is done using
  3176.     UNIX shell-style wild-carding conventions.
  3177.  
  3178.     The expansion of the ':' character in user input, which normally
  3179.     expands to the "word under the cursor", is suppressed for DOS, due
  3180.     to the conflict with the drive-specifier syntax (e.g. "c:\foo").
  3181.     The character '&' may be used for this instead.
  3182.  
  3183.     In any version of vile there is a command, "set-dos-mode", which
  3184.     will a) strip all carriage-return ('^M') characters from the ends
  3185.     of lines in the buffer and b) set the "dos" mode so that carriage
  3186.     returns are appended when the file is written.  There is also a
  3187.     corresponding "set-unix-mode" command, which strips carriage
  3188.     returns, and forces "nodos" mode, so that they don't come back when
  3189.     you write the file.  In both cases, "dos" mode becomes a so-called
  3190.     "local" mode, so that the rest of your buffers will be unaffected.
  3191.  
  3192.     If you wish to change the screen colors which correspond to vile's
  3193.     internal notion of black, red, green, yellow, blue, magenta, cyan,
  3194.     and white, put a line in your vile.rc which resets the "palette"
  3195.     variable.  By default its value is "0 4 2 14 1 5 3 7", which
  3196.     associates each of the above colors with the appropriate PC color
  3197.     attribute.  The palette values are masked with 7 before being used
  3198.     as background colors, to prevent blinking characters.
  3199.  
  3200.  
  3201. Differences from vi
  3202. -------------------
  3203.  
  3204.     Of course, this really isn't vi.  Some of the following differences
  3205.     deserve changing, others do not.
  3206.  
  3207.     The parser for the ':' commands is not very vi-like.  For instance,
  3208.     ":e" will prompt you for a file name.  Most commands remember their
  3209.     last argument, and will present it as the default reply to their
  3210.     prompt.
  3211.  
  3212.     The backspace, line kill, word kill, job control, etc. characters
  3213.     are not rebindable.  They are, however, read from the tty settings
  3214.     on startup.
  3215.  
  3216.     There is no expansion of ! in filenames.  It is expanded in shell
  3217.     escapes, so the command ":!!" does rerun the previous shell command.
  3218.     Occurrences of '#' and '%' are recognized and expanded to the
  3219.     previous or current filename.
  3220.  
  3221.     Paragraph and section boundaries, for the {, }, [, and ] commands
  3222.     are configurable, but may not exactly match those in vi.  They are
  3223.     expressed via regular expressions.  The default regular expressions
  3224.     are quite complex, to support the traditional nroff and troff
  3225.     boundaries.  If you are just editing code, you may want to replace
  3226.     them:
  3227.  
  3228.         ; set paragraph and section r.e.s for speed on C/C++/perl code.
  3229.         set paragraphs=^$
  3230.         set sections=^[{^L]
  3231.  
  3232.     There is no special lisp support.  But then, when was the last time
  3233.     you heard of a lisp programmer that used vi?
  3234.  
  3235.     Of course, ex and open mode aren't there.  (Too bad.  I'd love
  3236.     to have a companion editor called "exile".)
  3237.  
  3238.     Most, but not all, of the word-motion-with-operator and end-of-line
  3239.     anomalies have been recreated.  One missing anomaly: In vile, "dw"
  3240.     on the last word of a line ending in whitespace deletes the
  3241.     trailing whitespace.  vi does not delete the whitespace.
  3242.  
  3243.     In the real vi, the '_' command is a little-used motion command,
  3244.     which moves the cursor to the start of the Nth next line, where N
  3245.     is the argument given, less 1.  So '2_' takes you to the start of
  3246.     the next line.  Primarily intended for use in an operator context,
  3247.     as in "2d_", it is always exactly equivalent in those cases to
  3248.     "stuttering" the operator, as in "2dd".  Most people know about and
  3249.     use the stuttered form, so in vile, the '_' command is used by
  3250.     default for buffer history.  If the regular vi behavior is desired,
  3251.     put the following in the .vilerc file:
  3252.  
  3253.         bind-key whole-lines _
  3254.  
  3255. Sample .vilerc
  3256. --------------
  3257.  
  3258.     Here's a sample .vilerc, to help get you started with the
  3259.     syntax and style of vile macros:
  3260.  
  3261.     set autoindent
  3262.     set fillcol 75
  3263.     set cmode
  3264.     set c-tabstop 4
  3265.  
  3266.     ; sitting on a brace, run the C code block through indent
  3267.     1 store-macro
  3268.         write-file
  3269.         filter-til goto-matching-fence "indent -st"
  3270.     ~endm
  3271.  
  3272.  
  3273.     ; format the current paragraph
  3274.     2 store-macro
  3275.         previous-paragraph
  3276.         filter-til next-paragraph "/usr/ucb/fmt"
  3277.     ~endm
  3278.  
  3279.     ; put 'fprintf(stderr,"\n");" into the file, and
  3280.     ; position the cursor to add to the string
  3281.     3 store-macro
  3282.         ~force next-line
  3283.         beginning-of-line
  3284.         insert-string "fprintf(stderr, \"\\n\");\n"
  3285.         ; six back, because it counts the newline
  3286.         6 backward-character
  3287.         insert-chars
  3288.     ~endm
  3289.  
  3290.     ; insert '> ' in front of every line from here til the end
  3291.     ; (this works because without argument, the default action
  3292.     ; for "goto-line" is to go to the end of file.
  3293.     4 store-macro
  3294.         substitute-til goto-line "^" "> "
  3295.     ~endm
  3296.  
  3297.     ; spelling keystroke: write the buffer, invoke ispell, and force
  3298.     ;     it to be read back in.
  3299.     2 store-macro
  3300.         write-file
  3301.         ; suppress "press return" with "1" argument to shell-command
  3302.         1 shell-command &cat "ispell " $cfilname
  3303.         replace-with-file $cfilname
  3304.     ~endm
  3305.     bind-key execute-macro-2 =
  3306.  
  3307.  
  3308.  
  3309.     ; the next three give more mnemonic window commands
  3310.     bind-key next-window ^N
  3311.     bind-key previous-window ^P
  3312.     bind-key split-current-window ^T
  3313.  
  3314.     bind-key execute-macro-1 ^A-C
  3315.     bind-key execute-macro-2 ^A-F
  3316.     bind-key execute-macro-3 ^A-K
  3317.     bind-key execute-macro-4 ^A-M
  3318.  
  3319. Notes on TERM types and Scrolling
  3320. ---------------------------------
  3321.  
  3322.     vile will determine the window size in one of three ways: first it
  3323.     will ask the tty driver (using a TIOCGWINSZ ioctl call under UNIX).
  3324.     Failing that, it will use the LINES and COLUMNS environment
  3325.     variables.  As a last resort it will use the size specified in the
  3326.     TERMCAP entry corresponding to the TERM variable.  In addition,
  3327.     vile will attempt to support the SIGWINCH signal, which allows it
  3328.     to track changes to the size of the window in which it is running.
  3329.  
  3330.     If scrolling is really slow, or really ugly (the status line hops
  3331.     around a lot), and you're using a vt102 or compatible terminal that
  3332.     you think should be able to scroll okay, then the problem is almost
  3333.     certainly your termcap entry, which probably doesn't describe
  3334.     scrolling regions adequately.  Most standard termcap entries are
  3335.     insufficient.  The standard "xterm" entry on many systems falls
  3336.     into this category, and vile contains code that, as a special case,
  3337.     will augment an "xterm" entry with the codes needed for scrolling
  3338.     regions.
  3339.  
  3340.     In any case, here's a termcap entry that should work:
  3341.  
  3342.         dy|vt102|vt-102|dec vt102:\
  3343.             :do=^J:co#80:li#24:cl=50\E[;H\E[2J:\
  3344.             :le=^H:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
  3345.             :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
  3346.             :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
  3347.             :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
  3348.             :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
  3349.             :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:\
  3350.             :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h:
  3351.  
  3352.     The crucial entries are cs and sr -- without both of them,
  3353.     vile will attempt to use dl and al, and will scroll by
  3354.     deleting and inserting a block of lines, giving the ugly
  3355.     behavior you're probably seeing.  If you define PRETTIER_SCROLL
  3356.     when building vile, it will alternately delete and insert lines,
  3357.     instead of deleting them all and then inserting them all.  This
  3358.     makes it look a _little_ better, but it's slower.
  3359.  
  3360.     ( Here is the terminfo entry equivalent to the above termcap entry:
  3361.  
  3362.     vt102|vt-102|dec vt102,
  3363.         xon,
  3364.         cols#80, lines#24, vt#3,
  3365.         bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
  3366.         clear=\E[;H\E[2J$<50>, cnorm=\E[?7h, cr=\r,
  3367.         csr=\E[%i%p1%d;%p2%dr, cub1=\b, cud1=\n,
  3368.         cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>,
  3369.         cuu1=\E[A$<2>, cvvis=\E[?7l, ed=\E[J$<50>,
  3370.         el=\E[K$<3>, home=\E[H, ht=\t, ind=\n,
  3371.         is2=\E[1;24r\E[24;1H, kbs=\b, kcub1=\EOD, kcud1=\EOB,
  3372.         kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR,
  3373.         kf4=\EOS, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>,
  3374.         rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>,
  3375.         rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
  3376.         sgr0=\E[m$<2>, smkx=\E[?1h\E=, smso=\E[7m$<2>,
  3377.         smul=\E[4m$<2>,
  3378.     )
  3379.  
  3380. Credits
  3381. -------
  3382.  
  3383.     Since version 6.1, Tom Dickey has been maintaining the "official"
  3384.     source tree, and release responsibilities.  Paul Fox maintains the
  3385.     mailing lists.
  3386.  
  3387.     This code has been written by a _lot_ of people, with help from a
  3388.     lot more sending in bug reports, fixes, and suggestions.  The
  3389.     authors of vile are Tom Dickey (dickey@clark.net) and Kevin Buettner
  3390.     (kev@primenet.com), and Paul Fox (pgf@foxharp.boston.ma.us).
  3391.  
  3392.     Names appearing within comments in the micro-Emacs source code are:
  3393.     Dave Conroy, Daniel Lawrence, John Gamble, Roger Ove, Dana Hoggatt,
  3394.     Jon Reid, Steve Wilhite, George Jones, Adam Fritz, D.R.Banks, Bob
  3395.     McNamara, and Brian Straight.
  3396.  
  3397.     Tom Dickey has contributed many code improvements and features, and
  3398.     has stabilized vile on both VMS and DOS.  Kevin Buettner has
  3399.     contributed lots of changes for X11 Toolkit support, as well as the
  3400.     bulk of the selection and video attribute mechanisms, and the bulk
  3401.     of the :map command.  Rick Sladkey has done great stuff making vile
  3402.     work correctly in Win32 environments, something I might not have
  3403.     done for a long time.  Some of the "ex" code is by Steve Kirkendall,
  3404.     author of the vi work-alike "elvis".  The regular expression code
  3405.     and documentation is by Henry Spencer.  The sample .vilerc was
  3406.     created by Dave Lemke; he also contributed code for new features,
  3407.     including the original native X support.  Eric Krohn has done some
  3408.     excellent testing and enhancement.  The implementation of
  3409.     rectangles and their operations was inspired by code from the
  3410.     'notgnu' editor, by Julie Melbin.  Patches to support OS/2 and
  3411.     Windows/NT came from Charles Moschel and Joe Greer, respectively.
  3412.     Clark Morgan and Greg McFarlane seem to run full regression tests
  3413.     on each new release, and always seem to find something to report.
  3414.     Sean Ahern is also always dependable for finding a bug or two per
  3415.     release.  The reference.doc file supplied with Bram Moolenaar's
  3416.     excellent Vim editor was useful in unraveling some of the less
  3417.     obvious parts of :map functionality.  In addition, his
  3418.     implementation of digraph insertion was used directly in the
  3419.     creation of digraphs.rc.  Thanks to Jukka Keto for contributing the
  3420.     c-filt.c code.
  3421.  
  3422.     The initial changes to create vile from micro-Emacs were all done
  3423.     by Paul Fox (pgf@foxharp.boston.ma.us).  (By the way, he is not the
  3424.     Paul D. Fox that wrote the Crisp editor.)
  3425.  
  3426. Problems
  3427. --------
  3428.  
  3429.     Send bug reports to
  3430.         vile-bugs@foxharp.boston.ma.us
  3431.  
  3432.     Requests to be put on the announcement list should go to
  3433.         vile-announce-request@foxharp.boston.ma.us
  3434.  
  3435. Copyright 1995,1996 by Paul Fox, Tom Dickey, and Kevin Buettner
  3436. ---------------------------------------------------------------
  3437.  $Header: /home/tom/src/vile/RCS/vile.hlp,v 1.314 1997/02/28 23:54:48 tom Exp $
  3438.