1Getting along with vile                                            version 9.8
2-----------------------                                            -----------
3
4                            Getting along with vile
5
6   Use Ctrl-D and Ctrl-U to scroll through this help information.
7
8   Type Ctrl-O to make this the only window on the screen. Type Ctrl-K to get
9   rid of this window.
10
11   First, to leave vile, use any of the following:
12
13   :q
14   :quit
15   :exit
16   :wq
17           (writes current buffer before quitting)
18
19   :q!
20           (quits without writing any changes!)
21
22   Q
23
24   :wwq or ZZ
25           (will write all changed buffers)
26
27   ^X-^C
28           (don't know why. They don't put in ":q" for us! Actually, if ^C is
29           your interrupt character, this won't get you out of vile.)
30
31   To get help (probably just this text), use any of:
32
33     :h
34     :help
35     ^X-h
36     ^A-h
37
38   The only vile commands described herein are those not present in vi, or
39   differing greatly from those in vi. There is a section at the bottom
40   describing other differences between vile and vi.
41
42   To get a complete list of all commands, type ":show-commands". To get a
43   list of all commands that contain the string "name", type ":apropos name".
44   These lists will show all command synonyms and key sequences that are
45   bound to the same function, along with a short description of the command,
46   and whether it is a motion or operator command.
47
48   For a list of motions, type ":describe-motions". Likewise, you can see a
49   list of operators by typing ":describe-operators".
50
51   To get information on a specific key-binding or function, use the
52   "describe-key" or "describe-function" commands. You will be asked for a
53   keystroke or function name, and a short description will be shown.
54
55   You needn't type full command names -- type a few characters and hit TAB
56   to perform command completion. Hitting a second TAB will pop up a window
57   containing the list of possible completions.
58
59   If your screen hops around a lot when you scroll, see the "Note on
60   Scrolling" section near the bottom of this file.
61
62
63General Remarks
64---------------
65   vile holds text in "buffers". Usually, these correspond to a file that you
66   are editing, but not always. For instance, a buffer might be used to
67   display this help text, or to hold the output of a shell command that you
68   have run. Buffers have names, and these usually match the names of the
69   files they contain.
70
71   Buffers are sometimes displayed in windows. A buffer may be displayed in
72   more than one window at the same time. There is no such thing as a hidden
73   window. All existing windows are on the screen. There may, however, be
74   hidden buffers, which are not currently associated with any window.
75
76   All yank/delete registers (the default unnamed register, the numbered
77   registers ("1-9") that hold line-deletes, and the named registers ("a-z"))
78   are global to the editor, and not attached to any single buffer. Thus you
79   can delete text in one buffer and put it back in another.
80
81   Undo operations are attached to a buffer, not a window. Thus if you have
82   two windows to the same buffer, and make a change in one, you can undo it
83   in the other.
84
85   vile supports many, many "modes" (aka options), which are thoroughly
86   explained in the section entitled "Editor modes". But do note that this
87   help file makes references to modes before the concept is fully described.
88   It's a chicken and egg problem....
89
90   vile is 8-bit clean, allowing it to be used more easily at non-English
91   speaking sites. See the section on "8-Bit Operation" for more information.
92
93
94Command Prefixes
95----------------
96   To extend the vi command set in vile, two (or three, depending on how you
97   count them) command "prefixes" exist. These keystrokes, in combination
98   with another key, can be bound as a pair to execute any vile function. The
99   default values for these prefixes are
100
101   +------------------------------------------------------------------------+
102   | Key:                             | Bound to dummy function:            |
103   |----------------------------------+-------------------------------------|
104   | ^X Control-X                     | cntl_x-prefix                       |
105   |----------------------------------+-------------------------------------|
106   | ^A Control-A                     | cntl_a-prefix                       |
107   |----------------------------------+-------------------------------------|
108   | # poundsign                      | function-prefix                     |
109   +------------------------------------------------------------------------+
110
111   If you find any of these keys hard to type, or would prefer that they are
112   all control characters (or all non-control), they can be changed by
113   binding a new key to the function listed above. See the section on "Key
114   Rebinding" below. If you do change the values of these keys, most of
115   vile's informational displays (the Binding List, for instance) will
116   reflect these changes. This documentation, of course, will not change.
117
118   (The '#' key is used in vi to give terminal independent access to function
119   key bindings. This is also true in vile -- if something is bound to '#2',
120   then it is also probably available with key F2 on your keyboard.)
121
122
123Buffer manipulation commands
124----------------------------
125   vile stores buffers in a sorted list. Depending on the setting of the
126   "autobuffer" mode, this list is either sorted in "most-recently-used"
127   order (this is the vile default), or in a fixed order dependent on the
128   order of editing (this is how vi normally does it, and can be attained by
129   turning "autobuffer" off, with "set noautobuffer").
130
131   _
132           Show a list of the first 9 buffers. Follow this command with a
133           digit to select that buffer, or simply repeat it ("__") to select
134           the buffer most-recently visited. In autobuffer mode, this is
135           identical to "_1". If autobuffer mode is off, the buffer which
136           will be visited with "__" is flagged with a '#' character in the
137           list. Modified buffers are preceded by a '*' in the history list.
138           There are many different ways to get the previous file:
139
140                __
141
142                _1
143                        (autobuffer mode on)
144
145                1_
146                        (autobuffer mode on)
147
148                :e#
149
150                ^^ (ctrl-^)
151                        (but many keyboards can't produce this)
152
153           The buffer number may also precede the '_' command. This is
154           necessary when visiting buffers numbered higher than '9'. For
155           example, one would type "13_" to visit buffer 13 in the list.
156
157           Use tab (or back-tab if supported) to scroll the list of 9 buffers
158           right/left. Pressing '_' will select the first listed buffer; the
159           1-9 digits also work as expected when the list is scrolled.
160
161           [ See the note under "Differences", below, for comments on vi's
162           use of '_'.]
163
164   :e
165           Edit a file. If the file is already in a buffer, that buffer will
166           be recalled into the current window. This occurs as follows: If
167           the name given contains no path delimiters (i.e. slashes), then it
168           will be compared to the existing vile buffer names. Failing that
169           comparison (or if there are any slashes in the name), the name
170           will be stretched into an absolute path, and will be compared to
171           the existing buffers' filenames. In either case, the matching
172           buffer will be chosen. If there are no such matches, the file will
173           be fetched from the filesystem. This matching technique introduces
174           an ambiguity, since buffer names are created from the last path
175           component of filenames. To force vile to edit a file from the
176           current directory whose basename matches that of one that was
177           edited elsewhere, simply preface the name with "./". For example,
178           if you edit "../Makefile" and later attempt to edit "Makefile",
179           vile will assume you are referring to the _buffer_ named
180           "Makefile". To get the file in the current directory, specify
181           "./Makefile".
182
183   :e!
184           Re-edit a file. A different filename can be given, and the buffer
185           name will change to match it. This command is not as necessary in
186           vile as it is in vi, since multiple buffers may have outstanding
187           unwritten changes.
188
189   ^X-_
190           Identical to '_', except that the selected buffer is placed in the
191           current window (windows are described in the next help topic).
192           This is most useful when:
193              * two windows show a different view of the same buffer (for
194                illustration's sake, call the views "A" and "B").
195              * :e is used to open a new buffer (call this view "C"), which
196                obscures "A".
197              * eventually, you decide to return to "A" and "B".
198
199           ^X-_1 does the trick (reverts to views "A" and "B"), but _1 simply
200           moves the cursor into B's window, retaining views "C" and "B".
201
202   :n
203           Go to the next buffer. "Next" means "least recently used" in
204           autobuffer mode. In noautobuffer mode, "next" means next in
205           numeric sequence. (The ":n file ..." version of the command is not
206           supported.)
207
208   :rename-buffer
209           Rename the current buffer. Prompts for a new name. Does not affect
210           the filename associated with the buffer. Use ":f" to do that. This
211           command is useful for renaming the "[Output]" buffer, if you wish
212           to preserve its contents, but run a new command.
213
214   :set-window
215           Set the current window to the specified buffer. This is useful
216           especially when you have split the screen into a number of windows
217           and want to override the automatic layout of "#" and "%" buffers.
218
219   :rewind
220           Go to the first buffer. This is used only in 'noautobuffer'
221           (vi-style buffering) mode. It does nothing in "autobuffer" mode.
222           Remember that "autobuffer" mode is the default.
223
224   :unmark-buffer
225           Clears the "modified" status of a buffer. Useful for the creation
226           of temporary buffer(s) that are discarded when the editor exits.
227
228   :b
229           Edit a buffer. Recalls the named buffer. Does not look for a file
230           of that name. Will find "invisible" buffers.
231
232   :ki
233           Kill a buffer. Remove the buffer and its contents from the editor.
234           Will ask if changes to the buffer should be discarded. Multiple
235           buffer names may be specified via wildcards (e.g., :ki *.log) and
236           individual buffer names may be selected via name completion (using
237           the same conventions as in filename completion, described below).
238
239   ^X-e
240           Edit the file whose pathname appears under the cursor. For
241           example, if you are editing a makefile, you could edit one of the
242           source files by placing the cursor at the start of its name and
243           using this command. Note that this does not know about some
244           characters that your shell might usually translate for you, like
245           the '$' in '$HOME'.
246
247   ^X-k
248           Kill the buffer whose name or filename appears under the cursor.
249
250   *
251           Display a list of all buffers, or make that display go away if
252           it's already present. Leave your finger on the key, and it's easy
253           to create and destroy the list. The buffers are numbered; the
254           numbers correspond to the history numbers shown and used by the
255           '_' command, described above. (If the buffer number is greater
256           than 9, then the "nn_" form of the '_' command must be used, since
257           '_' will only accept a single following digit.) The order of the
258           list is either most-recently-used, or fixed, depending on the
259           setting of "autobuffer" mode (see below). vile attempts to keep
260           the contents of the buffer list window up to date if it is left up
261           on the screen while other buffer manipulation commands are given.
262
263   ^A-*
264           Always display a list of all buffers. Useful for updating the list
265           if it's already on the screen but may be out of date. Any argument
266           will cause the list to include _all_ buffers, even those normally
267           considered "invisible". (For example, macros are stored in
268           "invisible" buffers.) [This command isn't as necessary now that
269           the buffer list is maintained dynamically...]
270
271
272Window manipulation commands
273----------------------------
274   ^X-2
275           Make Two windows. Splits the current window in half. This is the
276           usual way to create a new window.
277
278   ^K or ^X-0
279           Get rid of (Kill) this window.
280
281   ^O or ^X-1
282           Make this the Only window on the screen.
283
284   ^X-o
285           Move to the next window.
286
287   ^X-O
288           Move to the previous window.
289
290   v
291           Make the current window smaller.
292
293   V
294           Make the current window larger.
295
296   ^A-^D
297           Scroll the next window down half a screen.
298
299   ^A-^U
300           Scroll the next window up half a screen.
301
302   ^A-^E
303           Scroll the next window up one line.
304
305   ^A-^Y
306           Scroll the next window down one line.
307
308           (The previous four commands are useful when comparing two buffers.
309           Mnemonic - think of them as affecting the "A"lternate window.)
310
311   zH zM zL
312
313   zt zm zb
314           These are synonyms for vi's 'z+', 'z.', and 'z-', which position
315           the line holding the cursor at the top, middle, or bottom of the
316           screen, respectively. (Any of the second characters can be upper
317           or lower case.) Mnemonically, these correspond to the H, M, and L
318           screen positioning commands, or to "top", "middle", or "bottom" -
319           take your choice. In a macro, only the first character of the
320           argument is significant, but something like "position-window
321           middle" is most readable. Supplying a count will offset that far
322           from the top or bottom of window. (But the middle is always the
323           middle.)
324
325   ^X-^R
326
327   ^X-^L
328           Scroll the window right or left by 1/3 of a screen, or by the
329           number of columns specified. Changes the "sideways" value. Neither
330           of these commands will actually move the cursor in the buffer -
331           they only reframe your view into the buffer. If the cursor would
332           be forced to move off-screen (which is of course impossible and
333           undesirable) as a result of the requested sideways scroll, then
334           nothing at all will happen. The commands are arguably crippled as
335           is.
336
337   If for some reason you can't get your screen set right via a TERM
338   variable, try the ":screen-rows" or ":screen-columns" commands (which take
339   their args (number of rows or columns respectively) before you type the
340   ":").
341
342   [ I put the following bindings in my startup file (.vilerc):
343
344     bind-key split-current-window ^T        ; split into 'T'wo windows
345     bind-key next-window ^N                 ; 'N'ext window
346     bind-key previous-window ^P             ; 'P'revious window
347
348   Since ^K already 'K'ills a window, and ^O makes it the 'O'nly window,
349   these give more mnemonic, and faster, access to multiple windows. (These
350   would be the default, but ^N, ^P, and ^T have other meanings in real vi
351   (all of which have alternate bindings in vile.) ]
352
353
354File manipulation commands:
355---------------------------
356   The usual ":e", ":r", ":f", ":w" commands are available, though only ":e!"
357   and ":w!" are available of the "!" options. The command ":w >> filename"
358   appends one file to another. The ":r" command reads the named file in
359   after the current line. To read a file before the first line, use ":0r".
360   File completion works like command completion: using the TAB and '?' keys
361   you can complete or see next character choices. Additionally, on unix
362   hosts, backquotes may be used to invoke a shell command that returns the
363   path of a desired file. For example:
364
365     :e `which locks`       ; csh looks for script called "locks"
366     :e `type -path locks`  ; bash equivalent
367
368   The commands ":ww" and ":wwq" correspond roughly to ":w" and ":wq", but
369   they each write all modified buffers, rather than just the current one.
370   Giving any numeric argument to ":ww" (i.e. "1:ww") will suppress the
371   per-file and "Press return to continue" message. This may be useful when
372   using the command from within a macro.
373
374   The write-all-buffers command attempts to write all buffers whether marked
375   "modified" or not.
376
377   As in vi, ranges of lines specified by line numbers (including '.', '$',
378   and '%' shorthands) or marks may precede these commands. Unlike vi, search
379   patterns cannot be used as line specifiers.
380
381   In addition, two non-"colon" commands have been added:
382
383   ^R
384           Prompts for a filename, and then reads it in _above_ the current
385           line. If a register is specified (e.g., "a^R ), the file is read
386           into that named register, but not inserted into the current
387           buffer.
388
389   ^W
390           is a writing operator, which prompts for a filename, and writes
391           the specified region to that file. Like all operators, if the
392           command is repeated, as in ^W^W, then lines are affected. Use
393           10^W^W to write 10 lines.
394
395           If a register is specified (e.g. "a^W ) then the command is _not_
396           an operator, but writes the specified register to the named file.
397
398
399Shell Access
400------------
401   Anywhere a filename is valid, a command name is also valid, entered in the
402   form "!shell-command". The whole line is handed to the shell, and the read
403   or write operation is done on the command's standard input or output, as
404   appropriate. Thus you can type ":e !date" to edit a copy of today's date.
405
406   The ": !cmd" shell escape works pretty much as it does in vi. The command
407   ":!!" will rerun the previous such shell command.
408
409   The '!' operator works as a filter, as expected.
410
411   In addition, the ^X-! command runs a shell command and captures its output
412   in a specific buffer, called "[Output]". This is almost identical to ":e
413   !cmd", except that in that case the buffer is named according to the
414   command name.
415
416   These "output capture" commands are most useful in conjunction with the
417   "error finder", '^X-^X', described below.
418
419   Filename completion is performed on words of the shell command in response
420   to a TAB character. To actually include a TAB character in the shell
421   command, escape it with ^V. Command completion is not currently
422   implemented - so, for instance, $PATH is not searched for possible
423   completions to the first word of a command line.
424
425   On systems supporting job control, ^Z (or ":stop") will suspend vile.
426
427   The "set-environment-variable" (or "setenv") command can be used to export
428   new or changed environment values to spawned programs. (Note that this
429   might or might not affect the operation of vile features that are
430   themselves controlled by environment variables, since those variables may
431   only be checked once at the time that vile is started.)
432
433   The :cd and :pwd commands are of course supported. Unlike vi, filenames
434   will track their directory of origin, so you can't simply edit a file in
435   one directory, cd to another, and write it. You must explicitly write to
436   ./filename in the new directory to accomplish this. ":cd -" will return to
437   the previous directory, as it does in some shells. The CDPATH environment
438   variable provides a search path for the :cd command. This variable's path
439   delimiters are host-specific, as follows:
440
441   +------------------------------------------------------------------------+
442   | Unix                                | colon                            |
443   |-------------------------------------+----------------------------------|
444   | DOS, OS/2, Win32                    | semicolon                        |
445   |-------------------------------------+----------------------------------|
446   | VMS                                 | comma                            |
447   +------------------------------------------------------------------------+
448
449   Giving an argument to the ": !" (also called "shell-command" when writing
450   macros) will suppress the "Press return to continue" message after the
451   command runs.
452
453   Additional shell-related features are described in the section of this
454   help file entitled "Working in a project hierarchy".
455
456
457Text manipulation command:
458--------------------------
459   Remember, these are only the new or different commands. The standard vi
460   set should still work.
461
462   The vi "global" (":g") command is present. So is the "substitute" (":s")
463   command. These both look pretty different while they're being used than
464   they do in vi, due to the interactive nature of the prompting. And, since
465   the searching is done right after the pattern is entered, there may be a
466   slight delay while you're trying to finish typing your complete command.
467   (If the pattern does not exist, you may not get to finish typing your
468   command at all.) You can use the commands just as you would have in vi,
469   i.e. ":g/oldpat/s//newstring/" will work. But you won't see any of the '/'
470   characters. Try it- you'll get the idea. Line ranges are not possible on
471   ":g", but they are on ":s".
472
473   The ":g" command can be followed by any of the "global command" modifiers.
474   Use ":describe-globals" to see the whole list, or simply use
475   name-completion. These are the most commonly used:
476
477     * l (list),
478     * p (print),
479     * pp (print with buffer name and line number),
480     * < (left shift),
481     * > (right shift),
482     * r (read file),
483     * d (delete),
484     * L (lower case),
485     * U (upper case),
486     * ~ (flip case),
487     * put (append yanked text),
488     * Put (prepend yanked text),
489     * s (substitute),
490     * trim (trim trailing whitespace).
491
492   For example, ":g/pattern/Put" will insert the contents of the default yank
493   register just above every line containing "pattern". The ":g" command can
494   only be used over the entire file - smaller regions are not permitted.
495
496   The ":v" counterpart to ":g" is also implemented - it performs the given
497   command on all lines that don't match the given pattern.
498
499   The substitute command can be followed by any of 'g', a digit, or 'p', to
500   do the substitution for all occurrences, the n'th occurrence, or to print
501   the resulting line respectively. You can also add a 'c', and you will be
502   asked to confirm each replacement before it occurs. The text being
503   replaced will be highlighted, and you can answer with 'y', 'n', 'q', or
504   'a'. 'a' will suppress further prompting, and will do the rest of the
505   replacements.
506
507   The ":&" and '&' commands work much as they do in vi, and repeat the last
508   substitution. The '^A-&' command is a new operator (see below), so it can
509   work on regions: for example use '^A-&}' to "repeat the previous
510   substitution over the rest of this paragraph".
511
512   The named marks such as "'a" work as they do in vi. vile allows a decimal
513   digit as a mark. It also recognizes special marks for the beginning and
514   end of a selection: '< for the beginning and '> for the end (see the
515   discussion of the quoted motion command).
516
517  Infinite Undo
518
519   The regular undo ('u') and line-undo ('U') are available for all commands.
520   They are a little more predictable than their vi counterparts, since they
521   do not share the default yank register for their operation. Also,
522   line-undo ('U') is available until the next change anywhere in the file,
523   rather than until you leave the line.
524
525   vile also lets you undo all changes made to a buffer since it was first
526   edited (so-called "infinite undo"). The '^X-u' command will undo changes,
527   one by one (or given a count, several at a time). The '^X-r' command will
528   walk forward, redoing the previously undone changes one by one. A fresh
529   change to the buffer will cause previously undone changes to no longer be
530   redoable. Remember that with key rebinding, you can change your 'u' or 'U'
531   command to be an infinite undo, making it easier to type.
532
533   In addition, the '.' command, which normally re-executes the last
534   buffer-modifying command, has special behavior with respect to undo. If
535   the '.' command immediately follows one of the undo commands ('u', '^X-u',
536   or '^X-r'), then it will perform another undo or redo, as appropriate. If
537   there are any intervening commands, then '.' will re-execute the last
538   command prior to the undo. [ This modification to the behavior of "u."
539   does not conflict (much) with traditional use of '.', since by definition,
540   the sequence "u." is (almost) always identical to "uu", and the latter is
541   more easily typed. (Credit goes to the designers of "nvi" for this trick.)
542   (the one case I know of where "u." is not identical to "uu" is when
543   putting back the contents of the numbered registers: the sequence
544   "1pu.u.u.u. would successively insert the contents of "1, "2, "3, "4, and
545   "5, allowing you to choose the "correct" register. This sequence no longer
546   works. You can still put them _all_ back with "1p..... ("1p for screen)
547   and then delete the ones you _don't_ want. ]
548
549   The number of changes stored in the undo "history" is controlled by the
550   numeric mode "undolimit". The default history length is 10 - that is, only
551   10 changes may be undone. Set the undolimit to 0 for truly infinite undo.
552   This can consume a lot of memory. You can turn it completely off (and
553   purge the undo stack) by setting noundoable.
554
555   The cursor position after an undo may not always be the same as it would
556   be in vi.
557
558  Operators
559
560   vi has a class of commands known as "operators". Operator commands are
561   always immediately followed by a motion command. The region of text
562   affected by an operator is bounded on one end by the initial position of
563   the cursor, and on the other by the cursor position after the motion is
564   completed. Thus the delete operator ('d') can be followed by the word
565   motion command ('w'), causing the next word to be deleted. The sequence
566   "dG" will delete from the cursor through the end of the file, and "d/junk"
567   will delete to the next occurrence of the string "junk". As a special
568   "honorary" type of motion, operators can all be "stuttered" to affect
569   lines. Thus "dd" deletes one line, "4dd" affects 4 lines, etc.
570
571   Most operators affect the region exactly, but some cause only whole lines
572   to be affected. This is usually a function of what sort of motion follows
573   the operator, but can sometimes be affected by the operator itself. The
574   best example of motions having different effects is the 'goto-mark'
575   motions, the ''' and '`' commands. If a mark is set, say mark 'a', with
576   the 'ma' command, then if the command d`a is executed, the exact text
577   between the cursor and the mark will be deleted. If, on the other hand,
578   the d'a command is used, the deleted region will include the lines
579   containing the cursor and the mark in their entirety.
580
581   Some operators in vile can be "forced" to affect regions of whole lines,
582   though the motion wouldn't normally imply it, by using the '^X' form of
583   the command. (It's not really forced - it's really a separate operator.)
584   For example, "d%" (assuming you are on a curly brace) will delete a
585   C-style block of code. "^X-d%" will delete that same area, plus anything
586   else on the lines containing the curly-brace endpoints.
587
588   Note that some operators always affect whole lines, no matter how the
589   motion is specified. The '!' operator is an example: "!w" will always
590   filter an entire line, and not just a single word.
591
592   vile extends this notion of the "shape" of a region by adding the concept
593   of rectangular regions, whose boundaries are delimited by the rectangle
594   whose opposite corners are at the cursor and at the other end of the
595   motion, respectively. See the section "Rectangular regions" below.
596
597   The "show-operators" command will show all available operators. The
598   "show-motions" command will show all available motions. Any operator may
599   be followed by any motion.
600
601   There are several new operator commands in vile:
602
603   ^A-~
604           Is the operator form of the '~' command, so "^A-~~" changes the
605           case of all characters on the current line, "^A-~w" does it to a
606           word, "3^A-~}" does it for 3 paragraphs, etc. (In vile, the simple
607           '~' command will take a repeat count, unlike some versions of vi.
608           If you wish it to be an operator, rebind '~' to the "flip-til"
609           command.)
610
611   ^A-u
612           Like ^A-~, but converts the region to upper case.
613
614   ^A-l
615           Like ^A-~, but converts the region to lower case.
616
617   ^A-f
618           Format the region based on the current fill column. The initial
619           indentation of both the first and second lines of each "paragraph"
620           in the region are preserved, and all subsequent lines get the
621           second line's indentation. This makes indented/outdented
622           paragraphs (like this one) work correctly. (This is intentionally
623           _not_ the same behavior obtained by using "!fmt", since that
624           behavior is obviously available elsewhere.) The usual usage of
625           this command is "^A-f}", which reformats the current paragraph.
626           The re-formatting begins again with each new paragraph, where a
627           paragraph has the same boundaries used by the '{' and '}' commands
628           - i.e. blank lines, or lines beginning in .I .L .P .Q or .b. This
629           makes it possible to use "3^A-f}" or "^A-fG" to reformat multiple
630           paragraphs. The reformatting operation knows a little about both
631           C, C++, and shell comments, and will attempt to do the "right"
632           thing with lines that start with '#' or '*' characters. (It also
633           knows about the '>' character, making it fairly easy to reformat
634           mail and news inclusions... but is it ethical? :-)
635
636   ^X-s
637           For every occurrence of a search string, put in a replacement
638           string. This is similar to "s/pattern/replacement/g" over the
639           region.
640
641   ^A-&
642           Is an operator in vile, similar to the traditional & command. It
643           repeats the last substitution over the specified region. (Unlike
644           the '&' command, this one will remember trailing g, p, l, or
645           numeric options.)
646
647   ^X-d
648           Delete the region, including the lines it starts and ends on.
649
650   ^X-c
651           Change the region, including the lines it starts and ends on.
652
653   ^X-y
654           Yank the region, including the lines it starts and ends on.
655
656   ^A-t
657           Trim trailing whitespace from all lines in the region.
658
659   ^A-<SPACE>
660           Convert tabs to spaces, using the current tabstop value.
661
662   ^A-<TAB>
663           Convert as many spaces to tabs as appropriate.
664
665   ^A-b
666           Blank out a region. Turns the region to whitespace. Useful with
667           rectangular regions.
668
669   ^A-r
670           Open up a rectangle. Text to the right of the left edge of the
671           rectangular region will shift to the right by the width of the
672           rectangle, leaving a whitespace "hole".
673
674   ^A-q
675           Sweep out a rectangle with multiple motion commands. See
676           description of 'q', below.
677
678   ^A-s
679           Select and yank a region. The region will be highlighted on the
680           screen, as if it had been swept by a mouse. It is also yanked, as
681           with the 'y' operator. This operator is useful in combination with
682           the ^S motion command, which lets one reference the selected
683           region with other operators. (If you use this command much, it is
684           recommended that you bind it to and easier to type sequence, such
685           as 'S'.) See also the q (quoted motion) command.
686
687  Text insertion
688
689   ^X-p
690           Causes the previously yanked or deleted text, no matter how it was
691           obtained, to be inserted after the current line. Usually text that
692           did not consist of whole lines where it came from is inserted
693           immediately following the cursor.
694
695   ^X-P
696           As above, but the text is put before the current line. Thus "dw"
697           followed by a "p" command does a normal insertion of the deleted
698           word, whereas "^X-p" results in the word being inserted on a line
699           by itself.
700
701   R
702           vi's overwrite mode is supported. Note that the combination of
703           overwrite mode and the (ANSI) arrow keys can be used to give a
704           "picture drawing" mode of operation: anything you type goes into
705           the buffer without moving adjacent text, and you can move around
706           using the arrow keys without leaving overwrite mode. Hint: start
707           with a buffer full of lines that consist entirely of blanks (as
708           opposed to blank lines).
709
710   ^A-i
711   ^A-o
712   ^A-O
713           Like their 'i', 'o', and 'O' counterparts, but any autoindent or
714           cmode setting is ignored for the duration of this insert. These
715           are most useful when pre-formatted text is being pasted, as when
716           using a mouse.
717
718  Searching
719
720   ^X-/
721           Does a forward search for the "word" located under the cursor.
722
723   ^X-?
724           Does a reverse search for the "word" located under the cursor.
725
726   ^A-/
727           Does not do a search, but sets the search pattern to the "word"
728           under the cursor. Useful for "picking up" a word from one buffer,
729           and searching for it in another.
730
731   The following two commands may not always be present in vile, depending on
732   how it was built:
733
734   ^X-S
735           Incremental forward searching. As you enter the search string, the
736           cursor is advanced to the next match with what you've typed so
737           far. Use ^F and ^R to continue the search forward or in reverse,
738           using the current pattern.
739
740   ^X-R
741           As above, but in reverse.
742
743  Tags
744
745   vile supports vi-style "tags" files.
746
747   ":ta" or ":tag"
748           allows you to enter a tagname to locate. The editor opens a buffer
749           containing the requested tag. Take note that tag completion is
750           supported, so it's possible to type a partial tagname and then
751           press TAB to force vile to complete the name, assuming it's
752           unique. If not unique, press TAB twice to see a list of all
753           possible completions. Example (using the vile sources):
754
755         :ta is_sl<tab>
756
757           is completed as "is_slashc" . Pressing RETURN following completion
758           opens a buffer on estruct.h, with the cursor positioned at the
759           first definition of this tagname.
760
761   ^]
762           Uses the identifier currently under the cursor as the tagname.
763
764   ^T or ^X-^] or ":pop"
765           - pops to the file and location just previous to the last tag
766           command.
767
768   ^A-^] or ":next-tag"
769           continues searching through the tags file(s) for additional
770           matches.
771
772   When one of these commands is used, vile will (by default) look for a file
773   named "tags" in the current directory, and load it into a hidden buffer
774   for use during tag searches. This buffer is editable if you wish (":e
775   tags"), but will not appear in the buffer lists. If a buffer named "[Tags
776   1]" is already available when a tag is first requested, it will be used
777   instead of a file found by searching the tags setting, and of course will
778   remain visible.
779
780   Take note that the tag locate and pop commands, by default, move the
781   cursor out of the current window if the target tag is located in one of
782   the editor's other windows. To "pin" all locate and pop actions to the
783   current window, set pin-tagstack mode.
784
785   The name of the default tags file may be changed with "set tags" (see
786   "tags" under "Editor modes", below). If multiple filenames are given in
787   the "tags" setting (separated by whitespace), they are searched in order,
788   and placed in buffers named "[Tags 1]", "[Tags 2]", "[Tags 3]", etc.
789
790   Tags searched for using '^]' will always be matched exactly. If the ":ta"
791   form of the command is used, tag matches will be exact unless the mode
792   "taglength" is set non-zero, in which case the first tag matching that
793   many characters will be used.
794
795   Filenames referred to in tags files are expanded, so environment variables
796   and shell special characters like ~ may be used.
797
798   The stack of buffer locations waiting to be "popped" to with the '^T' (or
799   '^X-^]' or ":pop") command may be viewed with the "show-tagstack" command.
800   The "[Tag Stack]" buffer is animated - it will dynamically keep track of
801   current tag references.
802
803   Limitations: In a real vi-style tags file, there are three tab separated
804   fields. The first contains the tagname. The second contains the (relative
805   or absolute) filename. Everything after the second tab is an arbitrary
806   ex-mode command. vile is not quite so flexible as regular vi, and only
807   supports a couple of commands in that last "field". It can be a line
808   number, in which case the tag is an absolute index into the file. Or, it
809   can be a search command. If it begins with a '/', the search goes forward.
810   If it begins with a '?', the search goes backward. In either case, the
811   matching delimiter _must_ be the last character on the line in the tags
812   file.
813
814   All of this isn't as bad as it sounds, since ctags, the program most
815   people use to generate tags files, does generate exactly this format.
816   (Surprise, surprise.) However, if you attempt to create your own tags
817   files, or have other tools that do so, you should be aware of these
818   limitations.
819
820   For further tags usage examples, refer to the section of this help file
821   entitled "Working in a project hierarchy".
822
823
824Miscellaneous commands
825----------------------
826   ^A-d
827           Remove blank lines ("delete-blank-lines"). If the cursor is on a
828           blank line, then it and any blank lines surrounding it will be
829           removed. If a non-blank line, then any immediately following blank
830           lines will be removed. If given an argument, will force exactly
831           that many blank lines to exist at that point, regardless of how
832           many were there before. Moves current location forward, to allow
833           repeated use.
834
835   ^A-e
836           Remove empty lines (delete-empty-lines). This command differs from
837           delete-blank-lines:
838              * empty lines contain no printable characters; blank lines
839                contain no characters.
840              * this command can be used with a range, and works as an
841                operator.
842              * the feature for forcing blank lines to appear is provided by
843                another operator force-empty-lines.
844
845   ^X-E
846           Force gaps with "empty" lines (no printable characters) to have
847           the same size (force-empty-lines). This uses the variable
848           $empty-lines as the size that should be used. Like
849           delete-empty-lines, this is an operator and can be used with a
850           range.
851
852   ^X-^X
853           The "error finder". Goes to the next file/line error pair
854           specified in the last buffer captured from a command's output.
855           This buffer is usually created with the ^X-! command.
856
857           For example, "^X-!cc -c junk.c" puts all of the compiler output
858           into the buffer named "[Output]".
859
860           Repeatedly hitting ^X-^X will position the editor at each error in
861           turn, and will eventually start over again at the top. The buffer
862           searched for "errors" will be the last shell command run, or the
863           buffer named with the "error-buffer" command. The "Entering
864           directory XXX" and "Leaving directory XXX" messages that GNU make
865           puts out with the -w switch are honored, so that files are found
866           with the correct path.
867
868           Tip: I use the following macro to quickly grep a source directory
869           for the string under the cursor:
870
871             use-register g load-register "^X!egrep -n : *.[chs]^M"
872
873           where the ^X and ^M are each single control characters, entered
874           using ^V to escape them. Then I invoke with @g to execute. [NB:
875           this macro won't work with the DOS/VMS/Win32 versions of vile,
876           since ':' doesn't expand to the word under the cursor on those
877           hosts due to conflicts with filename drive/disk delimiters. For
878           those hosts, substitute '&' instead.]
879
880           The command parsing is done with regular expressions. Vile
881           compiles these from the buffer [Error Expressions], which are a
882           set of regular expressions with extra embedded information.
883           Unescaped '%' followed by 'V', 'B', 'F', 'L', 'C' or 'T'
884           substitute verb (Entering/Leaving for gmake), buffer (i.e.,
885           scratch buffer with a bracketed name), file, line, column and text
886           fields.
887
888           The line and column numbers are 1-based, treating tab character as
889           a single column. Use %l and %c, respectively for 0-based values.
890
891           The V, B, F, T substitutions are for nonblank fields, which is not
892           always enough, so vile additionally recognizes a range in
893           brackets, e.g.,
894
895         ^%[^:   ]:\s*%L:%T
896
897           is compiled as
898
899         ^\([^:  ]\+\):\s*\([0-9]\+\):\(.\+\)
900
901           The expressions can be manipulated with scripts:
902
903             ; example of a macro to add to [Error Expressions]
904             store-procedure AddError
905                     ~local %oldbuffer
906                     setv %oldbuffer=$cbufname
907                     compile-error-expressions
908                     yank-line
909                     edit-file '[Error Expressions]'
910                     unsetl view
911                     goto-beginning-of-file
912                     put-before
913                     unmark
914                     setl view
915                     buffer %oldbuffer
916                     compile-error-expressions
917             ~endm
918
919           Use the show-error-expressions command to display the contents of
920           the [Error Expressions] buffer, along with the expanded regular
921           expression and annotation for the substitutions. The result is
922           shown in [Error Patterns].
923
924   ^X-t
925           Set or report on the tab-stop width. To set, the spacing must
926           precede the command, as in "4^X-t". The "set tabstop" command
927           described below does the same thing. The status output indicates
928           whether the buffer is currently using the local or global copy of
929           the tabstop value.
930
931   ^X-f
932           Set the local fill-column to be used with ^A-f and auto-wrap mode
933           on insert. The default value is 7/8's of the screen size, with a
934           maximum of 70. Since arguments come before commands, you type:
935           65^X-f. The "set fillcol" command does the same thing. The status
936           output indicates whether the buffer is currently using the local
937           or global copy of the tabstop value.
938
939   ^X-X
940           Set current encryption key for this buffer. See "Encryption" below
941           for more information.
942
943   K
944           Count prefix. The first time you type it, it is equivalent to an
945           argument of 4 to the following command. If you repeat it, it
946           becomes worth 16, the next time 64, etc...
947
948   %
949           In addition to finding matching braces, brackets, and parentheses,
950           the '%' command will find matching #if's, #ifdef's and C-style
951           comments. If the cursor is on the # of "#ifdef"/"#if", the '%'
952           command will find the matching "#endif" or "#else". On an "#else"
953           it will find "#endif", and on "#endif" it will go back up to the
954           "#ifdef"/"#if". If the cursor is on any part of a "/*" or "*/"
955           sequence, it will find the appropriate corresponding C comment
956           endpoint. (See fence-if, fence-pairs to customize this behavior).
957
958   \
959           Identical to the ` motion, in that the cursor moves to the
960           specified mark (i.e. \a moves to mark 'a'). When used with an
961           operator command, the resulting region is rectangular instead of
962           "exact". This is similar to the ' motion, which also goes to [the
963           line holding] the mark, and causes regions to become "full line"
964           regions.
965
966   q
967           A "quoted motion" command. After entering 'q', more motion
968           commands are accepted until another 'q' is entered. The result of
969           the motion is the cumulative effect of all the entered motions.
970           Thus, one might type:
971
972         dq<arrow><arrow><arrow>...<arrow>q
973
974           to delete all of the text between the starting point and the final
975           cursor position.
976
977           Any motion command can appear in between the two 'q' commands. If
978           used alone, i.e., not in an operator context, then the spanned
979           text is highlighted, and yanked on completion (as well as setting
980           the special named marks '< and '>) as a side effect. The resulting
981           selection can then be manipulated with the ^S pseudo-motion,
982           below. The selection-clear command removes the selection's
983           highlight attributes.
984
985           Most motions will select up to but not including their endpoint.
986           The 'e', 'E', 'f', 't', and '%' commands are exceptions to this.
987           If used in an operator context the cursor position may sometimes
988           appear incorrect. This is because operators sometimes change the
989           cursor location internally to force the motion to do the "right"
990           thing, and the 'q' command makes these internal "fudge factors"
991           visible. An example of this is "dq%q" which does the right thing
992           (assuming the cursor is on a '(' to start) but which looks wrong,
993           since the cursor will overshoot the ')' before the second 'q' is
994           typed.
995
996           If a mouse is available on a Unix host, whether in an xterm via
997           the "xterm-mouse" setting, or in xvile, then button 1 can be
998           clicked to do the extensions, since it, too, is a motion command.
999           (Of course in xvile or winvile, it is easier to simply "click and
1000           drag" - the 'q' command isn't really necessary at all.)
1001
1002           Use the repeat-count to specify types of selection: exact=1
1003           (default), full-line=2, rectangle=3.
1004
1005   ^A-q
1006           As above, but the motions will sweep out rectangular regions.
1007
1008   ^S
1009           A motion, or "pseudo-motion" command. If a region of text has been
1010           previously selected, either with the mouse (if available) or with
1011           the keyboard selection operator (^A-s) it can be referenced by any
1012           other operator by applying that operator to the ^S motion. As an
1013           example, suppose a word is selected with the mouse, or with ^A-sw.
1014           Then, from anywhere in that buffer, one can use d^S to delete that
1015           word. ^S used by itself will move the cursor to the start of the
1016           selected region. ^S applied to the selection operator (^A-s) will
1017           extend the current selection to include the current location of
1018           the cursor.
1019
1020           ^S makes it possible to select any region (including rectangular
1021           regions) of text with a mouse, and then apply any vi operator to
1022           that region.
1023
1024   =
1025           If "visual-matches" is set, then vile will highlight all
1026           occurrences of a pattern that is searched for with one of the
1027           usual searching commands. The '=' command will clear this
1028           highlighting, until the next search for a different pattern.
1029
1030   :select-all
1031           On hosts where vile provides mouse support, the select-all command
1032           selects, highlights, and yanks all text in the current buffer to
1033           the unnamed register. Clear the selection's highlight attributes
1034           as follows:
1035
1036           +----------------------------------------------------------------+
1037           | Technique                       | Applies To                   |
1038           |---------------------------------+------------------------------|
1039           | selection-clear command         | any host                     |
1040           |---------------------------------+------------------------------|
1041           | left mouse button (LMB) click   | winvile                      |
1042           |---------------------------------+------------------------------|
1043           | click mode line with LMB        | win32 host                   |
1044           |---------------------------------+------------------------------|
1045           | press ESC                       | winvile                      |
1046           +----------------------------------------------------------------+
1047
1048  Internal State
1049
1050   vile can display more of its internal "state" than traditional vi.
1051   Portions of the internal "state" may be viewed using various "show-xxx"
1052   commands:
1053
1054   :show-abbreviations
1055           displays list of shortcuts defined with the ":abbr" command.
1056           (synonymous with ":abbr<cr>")
1057
1058   :show-buffers
1059           displays the current list of available buffers. Given any numeric
1060           argument, will list _all_ buffers, even those normally invisible
1061           or considered temporary.
1062
1063   :show-color-schemes
1064           displays a color chart of the user-definable color schemes (see
1065           palettes.rc for examples)
1066
1067   :show-colors
1068           displays a color chart of the builtin color names, the internal
1069           coding used in the syntax filters (e.g., C0), the $palette mapping
1070           and examples in bold, italic, etc.
1071
1072   :show-commands or show-bindings
1073           displays the list of commands and the keys bound to them.
1074
1075   :show-global-modes, show-modes
1076           both synonymous with ":set<cr>"
1077
1078   :show-help
1079           synonymous with ":help", '^A-h', etc.
1080
1081   :show-history
1082           displays the user's command line history.
1083
1084   :show-local-modes
1085           Shows the local value of each mode, if it differs from the global
1086           value. If a majormode is set on the buffer, that is used for the
1087           "global" value in this display.
1088
1089   :show-majormodes
1090           displays the builtin and user-defined major modes.
1091
1092   :show-mapped-chars
1093           displays the strings mapped for command mode with ":map".
1094           (synonymous with ":map<cr>")
1095
1096   :show-mapped!-chars
1097           displays the strings mapped for insert mode with ":map!".
1098           (synonymous with ":map!<cr>")
1099
1100   :show-printable
1101           displays a table of the first 256 printable characters, with
1102           associated types. To allow it to fit within 80 columns,
1103           abbreviations are used, which are the same names as used in
1104           character classes.
1105
1106           Use a repeat count to show data for the wide locale. The default
1107           (no repeat count) shows the narrow locale. Use show-wide-printable
1108           to see wide characters past the first 256.
1109
1110           If showchar is set, this also shows a line for the current
1111           character in the current buffer, with the character type
1112           information for that character.
1113
1114   :show-registers
1115           displays the current contents of the named and numbered registers.
1116
1117   :show-system-mapped-chars
1118           displays the strings mapped to represent the terminal's function
1119           keys.
1120
1121   :show-tagstack
1122           displays the contents of the "tags stack", the list of locations
1123           from which the ":ta" or '^]' commands have been used, and to which
1124           the ":pop" and '^T' (or '^X-^]') commands will return.
1125
1126   :show-terminal-chars
1127           displays the list of special chars normally associated with the
1128           TTY driver, i.e. backspace, interrupt, suspend, etc.
1129
1130   :show-variables
1131           displays the list of vile state $variables and temporary
1132           %variables, and their values. Use a repeat count to show all mode
1133           variables, including majormode submodes rather than just the state
1134           variables.
1135
1136   :show-wide-printable
1137           displays a table of the "wide" (Unicode) printable characters,
1138           with associated types. To allow it to fit within 80 columns,
1139           abbreviations are used, which are the same names as used in
1140           character classes.
1141
1142           Use a repeat count to show the data for successive "pages" of 256
1143           characters, e.g., 1 for 256-511, 2 for 512-767, etc.
1144
1145           This uses the same buffer as show-printable. If showchar is set,
1146           this also shows a line for the current character in the current
1147           buffer, with the character type information for that character.
1148
1149
1150New Registers
1151-------------
1152   In addition to the usual "a through "z, and "1 through "9, vile has
1153   additional registers.
1154
1155   The register named '<' contains the last few hundred keystrokes that have
1156   been typed by the user. The principle use for this is to make it easier to
1157   create :map commands based on commands you've already given. [It's also
1158   useful sometimes when debugging to be able to see what key sequence led to
1159   a problem...]
1160
1161   The register name '.' contains the current selected text in xvile. Also in
1162   xvile, the register name ';' is a synonym for the clipboard. Other
1163   versions of vile permit use of '.' and ';' as supplemental register
1164   storage.
1165
1166   The register name '"' (" is double-quote) is a synonym for the default
1167   unnamed register, which is also sometimes referred to as register 0.
1168
1169
1170Completion
1171----------
1172   Many responses to vile prompts need not be typed in their entirety. vile
1173   can complete the response for you. This applies to command names, file
1174   names, vile modes, vile variables, tags, buffers, and the "terminal
1175   characters".
1176
1177   To invoke vile completion, type a few characters and hit TAB (or your
1178   current "name-complete" terminal character). Hitting it a second time will
1179   pop up a window containing the list of possible completions. If there are
1180   more completions than will fit in the window, hitting further TAB
1181   characters will cause that window to scroll through the choices. The
1182   window will go away when the current command is finished.
1183
1184   An older form of completion is also supported:
1185   You can also type a question mark (or the current "test-completions"
1186   terminal character) to display a list of the characters that you would
1187   have to type to complete the command. For example, to complete the
1188   "unmark" or "unmap" commands:
1189
1190         :unm?                   - you type
1191         :unm{a}[pr]             - you see
1192
1193   This style of completion-display shows curly braces around the string that
1194   will be supplied by pressing TAB, and square brackets around characters
1195   that you must type to make the command unique.
1196
1197
1198Arrow keys
1199----------
1200   vile will understand your terminal's arrow keys, as long as they are
1201   described correctly in the termcap/terminfo database. The keys are
1202   interpreted as function keys, and are by default bound to the up, down,
1203   left, and right screen motions. These bindings are honored in insert mode
1204   as well as command mode.
1205
1206
1207Rectangular regions
1208-------------------
1209   Just as the regions defined by vi's commands and motions can either be
1210   "exact", or encompass "full lines", regions in vile can in addition be
1211   "rectangular". The easiest way to use a rectangular region is with the '\'
1212   motion, which, like '`' and ''', goes to a named mark. The region it
1213   describes, however, is "rectangular" (instead of "exact" or "full line").
1214   The following operators know how to correctly act on rectangular regions:
1215
1216   ^A-r
1217           Opens up a rectangle. Text to the right of the left edge of the
1218           rectangle is shifted right by the width of the rectangle.
1219
1220   >
1221           Shift right. Identical to '^A-r' when region is rectangular.
1222
1223   d
1224           Deletes the (rectangular) region. Text to the right moves left to
1225           fill the rectangle.
1226
1227   <
1228           Shift left. Identical to 'd' when region is rectangular.
1229
1230   y
1231           Yanks the (rectangular) region. (vile remembers that the yanked
1232           text is rectangular in shape.
1233
1234   c
1235           Change the region. If the region is _not_ rectangular, insert mode
1236           is entered after the region is deleted. If the region _is_
1237           rectangular, the user is prompted for text with which the lines of
1238           the rectangle will be filled.
1239
1240   ^A-u
1241
1242   ^A-l
1243
1244   ^A-~
1245
1246   ^A-b
1247           These four operators perform their character transformations on
1248           rectangular regions, as well as exact or full-line regions.
1249           (uppercase, lowercase, flip-case, and blank, respectively)
1250
1251   p P
1252           The 'put'ting commands know whether the text being 'put' was
1253           originally rectangular, and will do a rectangular insert of the
1254           text, in front of or behind the cursor. The cursor position
1255           defines the upper left corner of the insertion.
1256
1257   ^A-p
1258           These two forms of the put command force the text being
1259
1260   ^A-P
1261           'put' to be inserted as if it had been rectangular when originally
1262           yanked or deleted. The width of the rectangle is the length of the
1263           longest line in register being 'put'.
1264
1265   Note that because it is sometimes hard to manipulate rectangles containing
1266   or bordering on tab characters, currently (for some operations) vile
1267   "detabs" the region being operated on before commencing, and re-entabs the
1268   lines again after the operation. The re-entabing is limited to leading
1269   whitespace, and of course is suppressed if "notabinsert" mode is set. [
1270   This misfeature is arguably a bug, and may be fixed. In the meantime,
1271   you've been warned. ]
1272
1273
1274Editor modes
1275------------
1276   Modes come in various flavors and types and constitute the editor's
1277   primary configuration mechanism. vile supports these mode types:
1278
1279   boolean enum int string
1280
1281   The value of a mode is specified via "set" or "setl" (the latter command
1282   _only_ affects buffer modes, as described below). Mode values may be
1283   cleared with "unset" (or "unsetl" for buffer modes), as well as other
1284   idioms described later. Clearing a mode, by the way, is a fancy way of
1285   saying that its value is set to 0 or "", the latter for string types. When
1286   an enum mode is cleared, vile selects whichever enum constant is assigned
1287   the internal (read compiled) value of 0. Some concrete examples:
1288
1289   +------------------------------------------------------------------------+
1290   | Technique                           | Applies To                       |
1291   |-------------------------------------+----------------------------------|
1292   | mode type        | mode name        | example usage                    |
1293   |------------------+------------------+----------------------------------|
1294   | boolean          | autoindent       | set autoindent                   |
1295   |------------------+------------------+----------------------------------|
1296   | enum             | visual-matches   | set visual-matches=reverse       |
1297   |------------------+------------------+----------------------------------|
1298   | int              | fillcol          | set fillcol=75                   |
1299   |------------------+------------------+----------------------------------|
1300   | string           | tags             | set tags="../tags tags"          |
1301   +------------------------------------------------------------------------+
1302
1303  Flavor: universal modes
1304
1305   These modes are not directly associated with buffers, windows, or
1306   languages. Consequently, a universal mode affects the editor under all
1307   relevant operating conditions.
1308
1309   To set/modify a universal mode, use the "set" command. Startup file
1310   examples:
1311
1312         set vtflash=normal
1313         unset flash           ; or    set noflash
1314         set errorbells
1315
1316   Since the set command (within a startup file) accepts multiple modes, this
1317   oneliner is equivalent:
1318
1319         set vtflash=normal noflash errorbells
1320
1321   To clear a universal mode use one of these idioms:
1322
1323         set    no<modename>
1324         unset  <modename>
1325         setno  <modename>
1326
1327   For completeness sake, note that the "local" version of the set/unset
1328   commands ("setl"/"unsetl") do not make sense (and elicit no effect) when
1329   used with universal modes.
1330
1331  Flavor: buffer modes
1332
1333   These modes are inherited from a set of "global" buffer modes, but bound
1334   to a specific buffer once a "local" value is independently established. To
1335   set and reset local modes, use "setl", "unsetl", or "setlno". An actual
1336   example is useful for illustration purposes.
1337
1338   When vile is started, the global value of "view" mode is unset by default
1339   (i.e., false) and all newly visited buffers are editable. But suppose I
1340   edited the file "precious.cpp", which I did not want to modify. There are
1341   two approaches that could be taken:
1342
1343         $ vile
1344         :set view          ; enable view mode globally
1345         :e precious.cpp    ; edited in "view" mode
1346         :e other.cpp       ; ditto
1347
1348   or
1349
1350         $ vile
1351         :e precious.cpp    ; initially edited in "noview" mode
1352         :setl view         ; "view" mode now bound to precious.cpp
1353         :e other.cpp       ; edited in "noview" mode
1354
1355   In the first approach, view mode is enabled globally and consequently
1356   affects all existing buffers and all subsequently created buffers. This
1357   solution works for the stated goal, but makes it impossible to modify any
1358   other buffers. The second approach affects only the targeted file.
1359
1360  Flavor: window modes
1361
1362   Similar to buffer modes, window modes are bound to a specific window once
1363   a local value is independently established. These modes are set/cleared
1364   with the same commands as buffer modes.
1365
1366  Flavor: majormodes (later)
1367
1368   Until the subject of syntax coloring is described, it's not very useful to
1369   discuss majormodes. So, in the listing of modes below, skip over anything
1370   tagged with (M). But don't fret, these modes are described separately in
1371   the topic entitled "Majormodes".
1372
1373  Current mode settings
1374
1375   To display modes, use "setall", "modes", "set all", or simply "set". vile
1376   displays all of the current mode values in the [Settings] buffer.
1377
1378   vile shows local mode values only if they differ from the global values,
1379   whether they have been independently set or not.
1380
1381   To show just the local mode values that differ from the global values, use
1382   show-local-modes.
1383
1384  Modes in detail
1385
1386   Shown next is a listing of vile's various modes. Synonyms, if they exist,
1387   are shown in parentheses and a trailing U, B, W, or M indicates whether
1388   the mode is universal, buffer, window or major.
1389
1390   alt-tabpos (atp)
1391           If set, vile will position the cursor over tab and control
1392           characters the way emacs would, that is, at the start of a tab or
1393           control character display sequence. If turned off (the default),
1394           the cursor is positioned over tabs and control characters the way
1395           it would be in vi, i.e. at the end of the tab or control character
1396           display sequence. (To match the behavior of earlier versions of
1397           vile, should be set.) (U)
1398
1399   animated
1400           Controls whether vile automatically updates the contents of
1401           scratch buffers when their contents would change as a side effect
1402           of commands. To retain the position within buffers when recreating
1403           them, use the reuse-position mode.
1404
1405           The animated buffers include:
1406
1407         [Binding List]
1408         [Buffer List]
1409         [Color Palette]
1410         [Color Schemes]
1411         [Command-Bindings]
1412         [Error Expressions]
1413         [Error Patterns]
1414         [Extra Colors]
1415         [Insert-Bindings]
1416         [Major Modes]
1417         [Map Sequences]
1418         [Map! Sequences]
1419         [Named Marks]
1420         [Printable Chars]
1421         [Registers]
1422         [Select-Bindings]
1423         [Settings]
1424         [Tag Stack]
1425         [Terminal Characters]
1426         [Variables]
1427
1428           Turning off "animated" is rarely necessary: the capability is
1429           present mostly as a debugging aid. (B)
1430
1431   autobuffer (ab)
1432           Controls whether vile uses "most-recently-used" style buffering,
1433           or vi-style (command-line order) buffers. That is, if autobuffer
1434           is on, then buffers are sorted in order of use, in that buffers
1435           not frequently used will drift to the end of the list. If this
1436           mode is not on, then vile will behave more like vi, in that
1437           buffers remain in a fixed order, that in which they were edited.
1438           (U)
1439
1440   autocolor (ac)
1441           Automatic syntax coloring. If set to zero, automatic syntax
1442           coloring is disabled. Otherwise, it should be set to a small
1443           positive integer which represents the number of milliseconds to
1444           wait before invoking the "autocolor-hook" hook. The editor will
1445           wait the specified amount of time for a "quiet interval" during
1446           which the user hasn't pressed any keys. (B)
1447
1448   autowrite (aw)
1449           vile will write out any changed buffers for which this mode is set
1450           before performing a ^Z, "stop", "suspend", ":!<cmd;>", or
1451           '^X-!<cmd;>'. The ":sh" command is not affected, nor is ":stop!"
1452           or ":suspend!". Since buffers inherit the global value of a mode,
1453           simply setting the global autowrite value will cause all buffers
1454           to be auto-written. Individual buffers can be forced or prevented
1455           from autowriting by setting the local value of the mode for those
1456           buffers appropriately. [In real vi, autowrite mode will also force
1457           buffers to be written when switching between files. This is
1458           unnecessary in vile.] (B)
1459
1460   autoindent (ai)
1461           During insert, newly created lines inherit their leading indent
1462           from the previous line in the buffer. (B)
1463
1464   autosave (as)
1465           Automatic file saving. Writes the file after every 'autosavecnt'
1466           characters of inserted text. Other file changes are not counted.
1467           (B)
1468
1469   autosavecnt (ascnt)
1470           How often (after how many inserted characters) will automatic
1471           saves take place. 256 by default. (B)
1472
1473   backspacelimit (bl)
1474           When in insert mode, this controls whether one can backspace past
1475           the point at which the insert began. (B)
1476
1477   backup-style
1478           Specifies the style used for creating file backups when a file is
1479           written. Can have values of "off", ".bak", and (under UNIX)
1480           "tilde", for no backups, DOS-style .BAK files, and file.c~ style
1481           backups, respectively. Files are copied before being written, to
1482           protect links to the original file. Permissions, modification and
1483           access times are all preserved. If creation of the backup fails,
1484           the write of the file will fail, unless it is forced using the
1485           ":w!" form of the write command. (B)
1486
1487   bcolor
1488           On systems supporting this, will set the background color. On most
1489           systems, the choice of colors is fixed, although the X11 version
1490           (xvile) can be given customized colors at startup or via
1491           .Xdefaults. See notes about the color palette down below, under
1492           DOS specifics. (U)
1493
1494   byteorder-mark (bom)
1495           is a prefix used to distinguish different types of UTF-encoding.
1496           It must be one of the following values:
1497
1498         "auto"
1499         "none" (default)
1500         "utf-8"
1501         "le-assumed"
1502         "be-assumed"
1503         "utf-16le"
1504         "utf-16be"
1505         "utf-32le"
1506         "utf-32be"
1507
1508           The "auto" setting tells vile to set the buffer's byteorder-mark
1509           value based on whatever the file-encoding happens to be.
1510
1511           The default value is "none", which is slightly different, telling
1512           it to accept byteorder-mark values as in "auto", but not to write
1513           them for buffers which have no explicit byteorder mark set.
1514
1515           The "utf-XXX" values are explicit settings, which override the
1516           auto/none logic. Use "le-assumed" or "be-assumed" for cases where
1517           the platform's preferred byteorder is known, and where byteorder
1518           marks may be absent from files, e.g., with Windows. (B)
1519
1520   bufname-expr
1521           Regular expression used for parsing of $bufname, subject to the
1522           cursor-tokens mode. If the expression is inactive, use
1523           character-class based internal function which combines buffer- and
1524           filename-classes. This is a buffer mode. (B)
1525
1526   ccolor
1527           On systems supporting this, will set the cursor color. On most
1528           systems, the choice of colors is fixed, although the X11 version
1529           (xvile) can be given customized colors at startup or via
1530           .Xdefaults. See notes about the color palette down below, under
1531           DOS specifics. (U)
1532
1533   check-access
1534           Check file permissions before source'ing it in a script. This
1535           tells vile to ensure that it uses only files that you own (or root
1536           owns), which are not writable by other users. Values include:
1537
1538                none
1539                        disables the check
1540
1541                current
1542                        checks files in the current directory.
1543
1544                home
1545                        check files in the home directory in addition those
1546                        checked for "current".
1547
1548                startup
1549                        check files in the startup path, as well as those
1550                        checked for "home".
1551
1552                always
1553                        like "startup", but also check permissions for
1554                        datafiles such as tags, menus and help-file.
1555
1556           The default value is "current". (U)
1557
1558   check-modtime
1559           Check modification-time. If a file has changed since it was last
1560           read or written, vile will issue a "file newer than buffer"
1561           warning and prompt appropriately for confirmation when
1562             1. popping up a window on an existing buffer,
1563             2. reading or writing the buffer, or
1564             3. after performing some shell command.
1565
1566           The prompt will occur only once, unless the file changes again, in
1567           which case the warning will be repeated. The warning will be
1568           repeated in any case if the file is being written. Invoking a
1569           shell, or suspending/restarting vile, will cause all visible
1570           buffers (those currently in windows) to have their times checked
1571           immediately. A file is considered "changed" if its modification
1572           time changes, or, under UNIX, if it is replaced entirely,
1573           resulting in a different inode number. (The "unique-buffers" mode
1574           must be active to enable the latter behavior.) (B)
1575
1576   cindent (ci)
1577           C-style indentation. Helps maintain current indentation level
1578           automatically during insert, like autoindent, above. See
1579           cindent-chars for additional information. Note that when the
1580           majormode cmode is in effect, cindent assumes a local buffer mode
1581           value of true. (B)
1582
1583   cindent-chars (cic)
1584           The list of characters interpreted by the cindent mode. These
1585           include
1586
1587                '#'
1588                        when a line starting with '#' is inserted, it is
1589                        indented to column 1. This is a temporary indent;
1590                        succeeding lines are indented normally. Also, lines
1591                        beginning with a '#' will not shift right with the
1592                        '>>' command.
1593
1594                ':'
1595                        indent the next line further, e.g., after a label.
1596
1597           as well as any character that may be listed in fence-pairs. If it
1598           is listed in cindent-chars as well, the left-character of a pair
1599           causes the next line to be indented more, and the right-character
1600           causes the next line to be indented less. (B)
1601
1602   cmode
1603           C-code mode. A built-in majormode that predefines cindent mode and
1604           separate suffix, tab and shiftwidth submodes. The topic "cmode:
1605           the original vile builtin majormode" discusses this majormode in
1606           more detail. (M)
1607
1608   crypt
1609           Causes buffer(s) to be decrypted when read, and encrypted when
1610           written. This is compatible with the UNIX crypt(1) routines used
1611           by vi, and is only available on platforms which have this feature
1612           enabled. See the section on "Encryption" for more information. (B)
1613
1614   color-scheme (cs)
1615           An aggregate of fcolor, bcolor, video-attrs and $palette. Color
1616           schemes are defined with the define-color-scheme command. (U)
1617
1618   comment-prefix
1619           A regular expression denoting the portion of a line that is
1620           replicated and untouched, except for leading indentation when
1621           doing text formatting. The expression should begin with "^", e.g.,
1622           the default value ^\s*\(\s*\([#*>]\)\|\(///*\)\)\+ is useful for
1623           matching shell comments (#), multi-line C comments (*), multi-line
1624           C++ comments (//), and email (>). (B)
1625
1626   comments
1627           A regular expression defining commented paragraph delimiters. This
1628           is used in addition to the "paragraphs" expression (see below)
1629           when reformatting a region. The net effect is that paragraphs
1630           inside of these comments are preserved when doing text
1631           reformatting, but are not reachable with the '}' and '{' motions.
1632           A pattern that consists of an empty comment line usually works
1633           well. (B)
1634
1635   cursor-tokens
1636           Controls whether vile uses regular expressions or character
1637           classes for parsing tokens from the screen for various commands.
1638           This uses an enumeration: both, cclass and regex. If "both", vile
1639           tries matching first with the regular expression, e.g.,
1640           bufname-expr for $bufname, and if that does not match anything,
1641           uses the character-classes. The main reason for providing the
1642           "both" option is that the older character-class based parsing for
1643           buffer name does not correspond exactly to a regular expression.
1644           (B)
1645
1646   dirc
1647           Causes vile to check each name when scanning directories for
1648           filename completion. This is slower, but provides additional
1649           information allowing you to distinguish between directory and file
1650           names in the prompt. (U)
1651
1652   dos
1653           On input, if the global copy of this mode is set, then incoming
1654           CR/LF pairs are taken as line terminators, the CR characters are
1655           stripped out, and the local dos mode is set for the buffer.
1656           (Actually, the local dos mode is only set if the _majority_ of
1657           lines had CR characters at the end.) If global dos mode is _not_
1658           set, then incoming CR characters will be left visible on the
1659           screen (as '^M'), and the local mode will not be set.
1660
1661           The percent-crlf mode tells vile how many lines in the buffer must
1662           have CR/LF endings for it to automatically treat a buffer in this
1663           manner.
1664
1665           On output, when writing a buffer with local dos mode set, all
1666           lines will be terminated with CR/LF pairs, rather than the usual
1667           single LF.
1668
1669           When buffers representing non-existent files are created they will
1670           inherit the line-style of the operating system (LF-only on UNIX
1671           and VMS, CRLF-style on DOS derivatives) regardless of the global
1672           setting of dos mode. However, even this can be overridden using
1673           the -u and -U options, which preset the $system-crlf variable used
1674           to initialize dos mode.
1675
1676           Setting dos mode makes editing binary files unreliable.
1677
1678           The global value for this mode is set on by default in DOS
1679           versions of vile, and should therefore be turned off if doing
1680           binary editing. (B)
1681
1682   errorbells (eb)
1683           Controls whether a bell sounds (or whether the screen flashes, if
1684           "flash" mode is on) when an error occurs. (U)
1685
1686   expand-chars
1687           Controls the set of characters that are expanded in command lines.
1688           These include '%' (the current buffer), '#' (the alternate
1689           buffer), '!' (the last shell command) and ':' (the token at the
1690           cursor position). For VMS, MS-DOS, OS/2, and Win32 hosts, this is
1691           '&'. (U)
1692
1693   expand-path
1694           Controls whether %/# are expanded to the full pathname of a
1695           buffer, or just to its basename (i.e. the name with the path
1696           stripped off). (U)
1697
1698   fcolor
1699           On systems supporting this, will set the foreground color. On most
1700           systems, the choice of colors is fixed, although the X11 version
1701           (xvile) can be given customized colors at startup or via
1702           .Xdefaults. See notes about the color palette down below, under
1703           DOS specifics. (U)
1704
1705   fence-begin
1706
1707   fence-end
1708           Respectively, the regular expressions for balancing simple
1709           (character-oriented, non-nestable) fences. (B)
1710
1711   fence-if
1712
1713   fence-elif
1714
1715   fence-else
1716
1717   fence-fi
1718           Respectively, the regular expressions for balancing line-oriented,
1719           nested fences, e.g., as C-preprocessor lines (the default). (B)
1720
1721   fence-limit
1722           Iteration timeout for complex fences, to limit pathological cases,
1723           e.g., with Perl's ambiguous block syntax. (B)
1724
1725   fence-pairs (fences)
1726           Each pair of characters in this string is taken to be a set of
1727           "fences", which should be matched with the '%' command. The
1728           default value is "{}()[]", which produces normal vi behavior. This
1729           can, for instance, be augmented with the '<' and '>' characters
1730           ("{}()[]<>>") to cause angle brackets to be matched as well. See
1731           "showmatch" mode for another use of the "fence-pairs" mode. (B)
1732
1733   file-encoding (fk)
1734           This is the character encoding of the buffer contents, which is
1735           not necessarily the same as the display's character encoding. It
1736           must be one of the following values:
1737
1738         "8bit"
1739         "ascii"
1740         "auto"
1741         "locale" (default)
1742         "utf-16"
1743         "utf-32"
1744         "utf-8"
1745
1746           The "auto" setting tells vile to determine the encoding by
1747           inspecting the buffer contents. The "locale" setting tells vile to
1748           assume that the buffer contents are in the current locale's
1749           encoding. The "8bit" setting corresponds to the 8-bit locale
1750           support used since 9.3i (20021223). (B)
1751
1752   filename-ic (fic)
1753           Ignore filename upper/lower case in filename completion. (U)
1754
1755   fillcol (fc)
1756           Sets the value for the fill column, which is the column at which
1757           autowrapping and region formatting will break lines. If zero, use
1758           the wrapmargin. If negative, count from the right margin. (B)
1759
1760   filtermsgs (fm)
1761           A few syntax errors are detected and highlighted by the
1762           syntax-highlighting filters. If set, this mode directs vile to
1763           write into the [Filter Messages] buffer the associated error
1764           messages, which can be used with the error-buffer command to step
1765           through the errors. (B)
1766
1767   filtername (fn)
1768           Specify a syntax-highlighting filter, for a given majormode. This
1769           is used in the filters.rc file, to handle special cases where
1770           different sets of keywords are applicable to a common syntax,
1771           e.g., C, C++ and Java. End users will not typically modify this
1772           mode. (B)
1773
1774   find-cfg
1775           Configures the builtin find feature, which is available on win32
1776           and Unix hosts. For further details, refer to the section of this
1777           help file entitled "Working in a project hierarchy". (U)
1778
1779   flash
1780           If your terminal can, will flash the screen rather than beeping on
1781           errors. No audible or visible indication will occur at all if
1782           "errorbells" mode is not set on. See also the vtflash mode
1783           (described below). (U)
1784
1785   for-buffers (fb)
1786           specifies whether globbing or regular expressions are used to
1787           select buffer names in the for-buffers and kill-buffer commands.
1788           (U)
1789
1790           The choices are
1791
1792                mixed
1793                        globbing with special exclusion for internal names,
1794                        i.e., with square brackets
1795
1796                glob
1797                        the same as filename globbing
1798
1799                regex
1800                        regular expressions
1801
1802   glob
1803           Controls how wildcard characters (e.g., '*' and '?') are treated
1804           in prompts for filenames. Set glob to 'off' to disable expansion,
1805           or to 'on' to use the internal globber. The internal globber will
1806           handle *, ?, [a-z] style ranges, environment variables, and the
1807           ~user notation for finding home directories.
1808
1809           On UNIX, glob can be set to be a pipe command that will expand
1810           more wildcards. The default value of glob on UNIX is "!echo %s",
1811           which should provide globbing that matches that of your shell. If
1812           set to a command that will separate filenames with newlines or
1813           nulls rather than spaces, then filenames containing spaces may be
1814           more easily edited. ("!/bin/ls -d %s" is one possibility, "!glob
1815           %s" is another if you use csh.) (U).
1816
1817   highlight (hl)
1818           When false, syntax highlighting is disabled in the corresponding
1819           buffers. This allows you to disable highlighting for all buffers
1820           or only certain ones. (B)
1821
1822   history (hi)
1823           When true (the default), commands from the :-line are logged in a
1824           buffer [History]. Turning this off causes the buffer to be
1825           removed. (U)
1826
1827   horizscroll (hs)
1828           If the cursor is moved "off-screen", this mode controls what
1829           happens. If set (as it is by default), the whole screen will shift
1830           sideways to make the cursor position visible. If not set, then
1831           only the current line will shift, which may be desirable on slower
1832           displays. (W)
1833
1834   identifier-expr
1835           Regular expression used for parsing of $identifier, which also
1836           corresponds to the pattern under the cursor used in tags and
1837           "screen-search-pattern-grab", etc., subject to the cursor-tokens
1838           mode. If the expression is inactive, use character-class, e.g.,
1839           the equivalent of
1840
1841         \<[[:ident:]]\+\>
1842
1843           This is a buffer mode. (B)
1844
1845   ignorecase (ic)
1846           Text searches normally match the pattern exactly. With this set,
1847           searches are case-insensitive. (B)
1848
1849   ignoresuffix (is)
1850           Strip the given pattern from a filename before matching it for
1851           majormode suffixes. Note well the difference between the mode's
1852           name and its behavior. (B)
1853
1854   implybuffer (ib)
1855           Causes vile to create a buffer when you write to a new file, or
1856           read from one (e.g., with ":r"). (U)
1857
1858   insert-exec (ie)
1859           Tells vile to interpret control characters for movement and
1860           undo/redo if they are bound to appropriate functions during insert
1861           mode. For example, ^F and ^B would scroll forward and backward. ^A
1862           and ^X bindings are honored as well. (U)
1863
1864           See the discussion of insert mode, in particular
1865
1866         describe-insmode-bindings
1867         describe-insmode-key
1868
1869   keep-position (kp)
1870           Choose where the cursor will be after making an ex-style command
1871           with a range. The mode value must be one of
1872
1873               emacs
1874               nvi
1875               vi
1876
1877
1878           where "emacs" is used to denote vi-like-emacs. The setting for
1879           "vi" matches the behavior of vi on AIX, HPUX and Solaris. Here are
1880           some examples to compare, where "top" and "bot" refer to the
1881           top/bottom of the range, and "n/c" indicates that the cursor does
1882           not move:
1883
1884           +-------------------------------------+
1885           | command      | vile | nvi | solaris |
1886           |--------------+------+-----+---------|
1887           | :%>          | top  | n/c | bot     |
1888           |--------------+------+-----+---------|
1889           | :%s/^/ /     | bot  | bot | bot     |
1890           |--------------+------+-----+---------|
1891           | :5,10>       | 5    | 10  | 10      |
1892           |--------------+------+-----+---------|
1893           | :.,.+5>      | n/c  | n/c | +5      |
1894           |--------------+------+-----+---------|
1895           | :.-5,.+5>    | -5   | n/c | +5      |
1896           |--------------+------+-----+---------|
1897           | :-5,+5>      | -5   | n/c | +5      |
1898           |--------------+------+-----+---------|
1899           | :-5,+5s/^/ / | +5   | +5  | +5      |
1900           +-------------------------------------+
1901
1902           POSIX does not provide details on this behavior. (U)
1903
1904   linebreak (lb)
1905           When linewrap mode is set, add blanks in the display to avoid
1906           splitting "words" (any nonblank text). (W)
1907
1908   linewrap (lw)
1909           Displays lines that are too long to fit on one line as a series of
1910           "wrapped" lines. Overrides left/right scrolling controlled by
1911           "sideways" and "horizscroll" modes. (W)
1912
1913   list (li)
1914           The buffer will be displayed with tabs and newlines made visible,
1915           instead of as whitespace. (W)
1916
1917   loading
1918           A flag whose state may display in the mode/status line, used by
1919           the capture.pl script to show when asynchronous data is loading.
1920           (B)
1921
1922   magic
1923           Honor unescaped regular expression metacharacters in search
1924           strings. See the section "Regular Expressions" for more detail.
1925           (B)
1926
1927   maplength
1928           Controls the maximum length of a :map string, to prevent runaway
1929           recursion. This is the total number of characters that can be
1930           gotten during a :map expansion; vile pushes characters onto the
1931           stack, so this is only a rough measure. (U)
1932
1933   maplonger
1934           Controls whether the longer or shorter of two "nested" map strings
1935           will be favored by the editor. When set, vile will match the
1936           longest available mapped string. When reset, (the default) vile
1937           will match the shortest available map. For more information, see
1938           the section describing the ":map" command, below. (U)
1939
1940   mcolor
1941           Specify the color of the modelines, normally in reverse video. See
1942           also "Setting Extra Colors". (U)
1943
1944   meta-insert-bindings (mib)
1945           Controls behavior of 8-bit characters during insert. Normally,
1946           key-bindings are only operational when in command mode: when in
1947           insert mode, all characters are self-inserting. If this mode is
1948           on, and a meta-character (i.e. a character with the 8th bit set)
1949           is typed which is bound to a function, then that function binding
1950           will be honored and executed from within insert mode. Any unbound
1951           meta-characters will remain self-inserting. (B)
1952
1953   mini-hilite (mh)
1954           When user toggles editing mode in the minibuffer (^G, mini-edit),
1955           display the minibuffer with the given attribute. These are the
1956           same as for visual-matches. (U)
1957
1958   mode-filename (mf)
1959           A regular expression describing filenames for which the
1960           corresponding majormode will be set. The expression is applied
1961           only to the portion of the complete pathname after removing the
1962           directory name. (M)
1963
1964   mode-pathname (mp)
1965           A regular expression describing pathnames for which the
1966           corresponding majormode will be set. The expression is applied to
1967           the complete pathname, in contrast to mode-filename. (M)
1968
1969   modeline
1970           Controls whether a vi-like modeline feature is enabled. This is a
1971           different term than the emacs-like modeline which acts as a
1972           status-line for each window. When enabled, vile scans the given
1973           number of lines from top and bottom of the buffer when it is first
1974           loaded into memory. It looks for lines containing one of these
1975           special markers after whitespace:
1976
1977         "vi:"
1978         "vile:"
1979
1980           or (depending on the configuration):
1981
1982         "xvile:"
1983         "winvile:"
1984
1985           After that, either a "set" command terminated by a colon, e.g.,
1986
1987         vile:txtmode:
1988
1989           or one or more mode assignments, treating colons as a whitespace
1990           separator, e.g, these are equivalent,
1991
1992         vile:ts=4 nu
1993         vile:ts=4:nu
1994
1995           The modelines at the top of the buffer are processed first
1996           (working forward from the top), then the ones at the bottom
1997           (working backward from the end). If the buffer is small enough,
1998           the available modelines could overlap; but the program interprets
1999           each line at most once.
2000
2001           This is a buffer mode, enabling its use in majormodes. (B)
2002
2003   modelines
2004           Controls the number of lines from each end of the buffer to scan
2005           for vi-like mode lines. Defaults to 5 (B)
2006           A regular expression describing pathnames for which the
2007           corresponding majormode will be set. (M)
2008
2009   mouse
2010           for OS/2, enable/disable the mouse in the console-window version.
2011
2012   multibeep
2013           If a motion command fails, then vile, like vi, will normally sound
2014           the bell. Turning this mode off prevents subsequent identical
2015           motion failures from also sounding the bell. That is, if you
2016           repeat a failed motion many times (e.g. by holding down the
2017           backspace key), you only get one beep. (U)
2018
2019   newline (nl)
2020           The buffer ends with a newline. This is set when reading a buffer.
2021           (B)
2022
2023   number (nu)
2024           All lines in the buffer will be prefixed by their line number. (W)
2025
2026   overlap-matches
2027           Modifies the highlighting shown by visual-matches to control
2028           whether overlapping matches are shown. For some conditions,
2029           setting this to false will present a more natural view, e.g.,
2030           "\a+", which would match sequences of alphabetic characters. In
2031           the normal case (show overlap), each time a new match begins vile
2032           will toggle the highlighting and produce an irregular effect. (B)
2033
2034   paragraphs
2035           A regular expression defining where the "next-paragraph" ('}') and
2036           "previous-paragraph" ('{') commands will go. (B)
2037
2038   pathname-expr
2039           Regular expression used for parsing of $pathname, which is
2040           expanded by ":" (or "&") in the minibuffer, subject to the
2041           cursor-tokens mode. If the expression is inactive, use
2042           character-class, e.g., the equivalent of
2043
2044         \<[[:file:]]\+\>
2045
2046           This is a buffer mode. (B)
2047
2048   percent-autocolor
2049           Maximum percentage of time during the autocolor interval that is
2050           desired to use for coloring the buffers. This helps with very
2051           large files, which take more time. If vile uses more time, then it
2052           will skip subsequent updates for the buffer, to keep up. When it
2053           does this, it sets a local copy of the autocolor buffer mode with
2054           the effective interval which is used. If this mode is zero, it is
2055           ignored, and vile can use 100% of the interval for autocoloring.
2056           (B)
2057
2058   percent-crlf
2059           Percentage of total lines which must end with CR/LF for vile to
2060           automatically convert buffer's recordseparator to crlf, if dos
2061           mode is set. (B)
2062
2063   percent-utf8
2064           Percentage of total characters which contain embedded nulls,
2065           making them look like UTF-16 or UTF-32 encodings. If file-encoding
2066           is set to "auto", and the match is higher than this threshold,
2067           vile will load the buffer data as UTF-8. The default (90) works
2068           well for text which is mostly Latin-1; you should set this to a
2069           lower value to work with text which does not follow that pattern.
2070           (B)
2071
2072   pin-tagstack
2073           If set, the editor does not change windows when executing tag
2074           locate/pop commands. Put another way, all tag push and pop
2075           operations are "pinned" to the current window. (U)
2076
2077   popup-choices (pc)
2078           Must be set to one of the following three values:
2079             1. "off",
2080             2. "immediate", or
2081             3. "delayed"
2082
2083           When enabled with either "immediate" or "delayed", vile pops up
2084           the [Completions] buffer showing choices for filename and command
2085           completion in response to a TAB. "immediate" will force the buffer
2086           to be popped up immediately if no progress is made in forming a
2087           completion. "delayed" will cause vile to wait until TAB is pressed
2088           a second time before popping up the completion choices. (U)
2089
2090   popup-msgs (pm)
2091           When enabled, vile pops up the [Messages] buffer showing the text
2092           that was written to the message line. Closing the window clears
2093           its content until the next message is written. This is most useful
2094           during the debugging of macros, since many messages may appear,
2095           each overwriting a previous one. This mode is treated specially
2096           during startup; unless the startup file (e.g., .vilerc) sets it,
2097           all messages will be popped up, then the mode will be initialized
2098           to "false". (U)
2099
2100   popup-positions (pp)
2101           Must be set to one of the following three values:
2102             1. "notdot",
2103             2. "bottom", or
2104             3. "top"
2105
2106           When enabled with either "bottom" or "top", vile pops up buffers
2107           showing buffers, completions and messages below or above the
2108           current window. "notdot" is the default behaviour, the popup
2109           window will appear away from the cursor line.
2110
2111   preamble (pre)
2112           A regular expression describing the first line of filenames for
2113           which the corresponding majormode will be set. For example, you
2114           may have a majormode "sh", with sh-preamble set to
2115           "^#\s*!\s*\/.*sh\>" to match the lines "# ! /bin/sh", "#!/bin/csh
2116           -f", etc. (M)
2117
2118   printing-low
2119           The integer value representing the first of the printable set of
2120           "high bit" (i.e. 8-bit) characters. Defaults to 0. Most foreign
2121           (relative to me!) users would set this to 160, the first printable
2122           character in the upper range of the ISO 8859/1 character set.
2123           Characters 128-159 are control characters in the ISO scheme (e.g.,
2124           ISO 8859-1). (U)
2125
2126   printing-high
2127           The integer value representing the last character of the printable
2128           set of "high bit" (i.e. 8-bit) characters. Defaults to 0. Set this
2129           to 255 for ISO 8859/1 compatibility. The printing-low and
2130           printing-high modes are not necessary if your system supports the
2131           locale functions. (U)
2132
2133   reader-policy (rp)
2134           Control whether buffers are initially read using the fast and/or
2135           slow methods. The fast method uses less memory, but in cases where
2136           there is little free memory, or the heap is fragmented, the slow
2137           method may work. However, the slow method is much slower. This
2138           mode defaults to "both", which means that the quick method is
2139           tried first, and if it fails to allocate the large chunks needed
2140           for the buffer, it will retry using the slow (small chunk) method.
2141           Set to "fast" to use only the fast method, and to "slow" for only
2142           the slow method. (U)
2143
2144   readonly (ro)
2145           Prevent writing a buffer to its associated file. Unlike "view"
2146           mode (see below) which prevents any modifications to a buffer,
2147           this mode allows changes, but prevents updates. This is set
2148           automatically for the output of shell commands and pipes. (B)
2149
2150   readonly-on-readonly (roro)
2151           Causes "readonly" mode to be set for read-only files. Normally
2152           vile will attempt to write files whether the operating system will
2153           allow it or not. This mode should be turned on to truly mimic vi's
2154           default behavior. (U)
2155
2156   recordseparator (rs)
2157           Specify format of files that vile reads and writes. Formats are
2158              * "auto" (to choose between lf and crlf, override dos mode)
2159              * "lf" (for Unix),
2160              * "crlf" (for DOS),
2161              * "cr" (for Macintosh, overridden by dos mode)
2162              * and "default" (lf or crlf, depending on the platform).
2163
2164           When reading from a file, vile can determine the file format
2165           automatically, and set a local value for this mode. When reading
2166           from a pipe, it uses the global value of recordseparator to decide
2167           how to split lines. Files created within vile do not automatically
2168           have a local recordseparator mode; they inherit the global mode
2169           setting. The commands
2170
2171         set-rs-cr
2172         set-rs-lf or set-unix-mode
2173         set-rs-crlf or set-dos-mode
2174
2175           are aliases which set the corresponding local mode values of
2176           recordseparator. Set the recordseparator on a given buffer to
2177           control how it is written. (B)
2178
2179   norectangle-insert-mode (rim)
2180           Insert, rather than overstrike, change changing text in a
2181           rectangle. (B)
2182
2183   remap
2184           Controls whether :map or :map! sequences entered with no explicit
2185           remapping control should be subject to remapping (i.e. recursive
2186           mapping). (U)
2187
2188   remapfirst
2189           Controls whether the first character of a map expanded due to :map
2190           or :map! is eligible for remapping. This is off by default for vi
2191           compatibility. (U)
2192
2193   report
2194           A threshold value that is used to control messages that report the
2195           number of lines deleted, changed, etc. Set it to 0 (zero) to
2196           disable the messages. (U)
2197
2198   resolve-links
2199           Controls whether vile fully resolves file names in cases where
2200           some path components are symbolic links. This makes vile smarter
2201           about symbolic links that provide multiple paths to a given file,
2202           and ensures that files are always represented in vile by their
2203           "true" names. (This can prevent multiple unintentional edits of
2204           the same physical file via different pathnames - but see also
2205           "unique-buffers", below.) It may trigger long timeouts on systems
2206           where symbolic links are used in conjunction with NFS automounted
2207           directories. (Note that this does not detect or prevent multiple
2208           edits caused by hard file links - only symbolic ones.) (U)
2209
2210   reuse-position
2211           Like the animated mode, restore the position in a scratch buffer
2212           when recreating it. This is useful for closely related commands
2213           such as show-printable and show-wide-printable that use the same
2214           scratch buffer name.
2215
2216   ruler
2217           Shows the current line and column in the status line, as well as
2218           what percentage of the current buffer's lines lie in front of the
2219           cursor. (This percentage is different than that given by ^G (the
2220           "position" function), which gives a percentage of characters
2221           rather than lines.) (B)
2222
2223   samebangs (sb)
2224           Controls whether the ":!!" and "^X-!" commands remember the same
2225           command string. (U)
2226
2227   sections
2228           A regular expression defining where the "next-section" (']') and
2229           "previous-section" ('[') commands will go. (B)
2230
2231   sentences
2232           A regular expression defining where the "next-sentence" (')') and
2233           "previous-sentence" ('(') commands will go. (B)
2234
2235   shiftwidth (sw)
2236           This is much like a tabstop, except that it is independent of
2237           hardware tabs and tab characters. It is the number of columns a
2238           line will shift by if the '<<' or '>>' commands are used, and it
2239           chooses the next column stop for the cursor if a '^T' or '^D' is
2240           typed during insert mode. Note that when the majormode cmode is
2241           enabled, shiftwidth assumes the local buffer mode value of 8. (B)
2242
2243   showchar (sc)
2244           Controls whether the modeline can show the %C formatted character
2245           at the current editing position. This is overridden by the ruler
2246           mode, to save space on the modeline (W).
2247
2248   showformat (sf)
2249           Controls when/whether recordseparator information is shown in the
2250           status line. Values are "always", "differs" to show when the local
2251           mode differs from the global, "local" to show whenever a local
2252           mode is set, "foreign" to show when the recordseparator differs
2253           from the native default and "never". On Unix, the native
2254           recordseparator is a line-feed, on DOS it is
2255           carriage-return/line-feed. (B)
2256
2257   showmatch (sm)
2258           During insert, if a closing "fence" character (usually '}', ']',
2259           or ')', but may be changed by setting "fence-pairs") is typed, the
2260           cursor will highlight the matching member of the pair for about a
2261           quarter second. (B)
2262
2263   showmode (smd)
2264           Causes an indicator on the modeline to indicate what mode vile is
2265           currently in: insert (I), replace (R), or command (none). (B)
2266
2267   showram (sr)
2268           Displays the amount of ram currently allocated at the end of the
2269           message line. (not in all versions) (U)
2270
2271   showvariables (sv)
2272           If set, causes the [Variables] buffer which is created by the
2273           "show-variables" command to be updated each time the screen is
2274           updated. (W)
2275
2276   sideways
2277           Will prompt for a new value for the sideways scroll offset, which
2278           allow display of a section of code normally off the screen to the
2279           right. Also affected by the ^X-^R and ^X-^L commands. (W)
2280
2281   smoothscroll (ss)
2282           Force smooth scrolling. By default, this option is turned off so
2283           that vile will try to keep up with your keystrokes instead of
2284           keeping the display up to date. Some keyboards repeat faster than
2285           the screen can keep up causing the screen to jump. If this bothers
2286           you, set smoothscroll to true. Warning: If your keyboard repeats
2287           really fast and you have smoothscroll enabled, it may take a while
2288           for vile to catch up. (U)
2289
2290   smartcase (scs)
2291           Overrides the setting of ignorecase when the pattern contains
2292           uppercase characters. (B)
2293
2294   spaces-after-sentence (sas)
2295           Insert two spaces after each sentence when formatting a paragraph.
2296           By default this option is turned on. When disabled, the format
2297           routine will insert only one space after each sentence. (B)
2298
2299   suffixes (suf)
2300           A regular expression describing filename suffixes for which the
2301           corresponding majormode will be set. The expression is applied
2302           only to the portion of the filename beginning with the first ".".
2303           If more than one of mode-pathname, mode-filename and suffixes are
2304           given, they are tested in this order. (M)
2305
2306   swap-title
2307           For xvile/winvile, if set, the editor displays its title as:
2308
2309         <current buffer name> - <editor name>
2310
2311           The swapped order is especially useful under limited screen real
2312           estate conditions. (U)
2313
2314   tabinsert (ti)
2315           Allow the physical insertion of tab characters into the buffer. If
2316           turned off ("notabinsert"), and an attempt is made to insert a tab
2317           character by explicitly typing it or by using shiftwidth or the
2318           line shifting commands, then the appropriate number of space
2319           characters will be inserted instead. Use '^V^I' to insert a real
2320           tab, and remember that pre-existing tabs will not be affected. Use
2321           the '^A-<SP>' operator command to eliminate pre-existing tabs from
2322           a region of text. (B)
2323
2324   tabstop (ts)
2325           Set the value for spacing of normal tabstops. Note that when the
2326           majormode cmode is enabled, tabstop assumes the local buffer mode
2327           value of 8. (B)
2328
2329   tagignorecase (tc)
2330           Causes tag searches to be done ignoring upper and lower case. (B)
2331
2332   taglength (tl)
2333           Sets the significant length for tags. If non-zero, lookups for
2334           names longer than the taglength value will only attempt to match
2335           that many characters. If a lookup is for a shorter pattern, or the
2336           value of taglength is zero, then the tags must match the lookup
2337           pattern exactly. This will not effect tags picked up from the
2338           cursor - they are always matched exactly. (B)
2339
2340   tagrelative (tr)
2341           Causes files looked up via the tags mechanism to be found relative
2342           to the location of the tags file, rather than relative to the
2343           current directory. This allows the same tags file to be useful
2344           from different locations, while not requiring absolute filenames.
2345           For example, using `set tags "tags ../tags"' would allow a single
2346           tags file (located in the parent) to be used in a small source
2347           hierarchy from either the parent or a child directory. (B)
2348
2349   tags
2350           Gives a path of names of file(s) in which to look up tag
2351           references. It is a whitespace-separated list of filenames.
2352           Relative pathnames in this list are evaluated with respect to the
2353           current directory of vile at the time of the tags lookup. (B)
2354
2355   tagword (tw)
2356           When scanning the word to lookup from the cursor position for the
2357           tags mechanism, grab the whole word rather than the substring
2358           starting at the cursor position. The latter, which is vi-like, is
2359           the default. (B)
2360
2361   terse
2362           vile produces more "status" messages than vi, which may become
2363           annoying at low baud rates. Setting terse mode will suppress many
2364           of these. (B)
2365
2366   terse-selections (tsel)
2367           Boolean indicating whether or not additional information is
2368           displayed about a selection. When false, the starting and ending
2369           positions of the selection are displayed as the selection is
2370           extended. The default is true. (W)
2371
2372   timeoutlen
2373           How long to wait for the characters of a :map'd sequence.
2374           Typically needed to resolve the ambiguity between a user-pressed
2375           ESCape key and an ESC character that is part of a function key
2376           sequence. vile will wait for "timeoutlen" milliseconds after
2377           seeing an ESC, in order to check the next character of input. The
2378           time defaults to 500, or half a second. Users of fast local
2379           screens, like a local xterm, may wish to reduce this to something
2380           like 50 for crisper response to a user-pressed ESC. (U)
2381
2382   timeoutlen-user
2383           If set non-zero, this will enforce a maximum waiting time for
2384           characters in a user-defined :map sequence. If zero, the value of
2385           timeoutlen, above, will be used for both "system" and user
2386           sequences. It is likely that a short time is desired for system
2387           sequences, and a long time for user sequences. For this reason the
2388           default value of timeoutlen-user is 60000. This will give a full
2389           minute to type each character of a user-defined :map. Be careful -
2390           extremely large values may overflow the word size on smaller
2391           machines, i.e, you will probably want to avoid setting
2392           timeoutlen-user larger than 65535. (U)
2393
2394   undo-dos-trim (udt)
2395           Controls whether trimming of carriage returns and control/Z done
2396           when converting between Unix and DOS line endings is undoable.
2397
2398   undoable (ua)
2399           Controls whether changes are saved on the undo stack. This is
2400           normally enabled, but you may wish to disable it to reduce memory
2401           overhead when filtering very large files. (B)
2402
2403   undolimit (ul)
2404           Sets a limit on how many undoable buffer-changing commands will be
2405           saved. If set to 0, there is no limit, and all changes are
2406           undoable. The default value is 10. (B)
2407
2408   unicode-as-hex (uh)
2409           If displaying a buffer whose file-encoding says it is one of the
2410           Unicode flavors, e.g., "utf-8", "utf-16" or "utf-32", show the
2411           values that are non-ASCII in "\uXXXX" format even if the display
2412           is capable of showing these as regular characters. (W)
2413
2414   unique-buffers
2415           When vile is asked to read a file into a buffer, it will first
2416           check to be sure that it doesn't already have a copy of that file,
2417           by the same or a different name. This can prevent multiple
2418           unintentional edits of a file which appears twice in the
2419           filesystem due to hard or soft links. On UNIX systems vile uses
2420           the combination of filesystem device and inode to check for
2421           uniqueness. vile will represent the file by the first name used to
2422           refer to it. Note that unless "check-modtime" is also set, a file
2423           with more than one name which is edited and then replaced on disk
2424           without the knowledge of the editor may still be edited twice.
2425           Setting this mode may be a no-op on non-UNIX systems. (U)
2426
2427   unprintable-as-octal (uo)
2428           If an 8-bit character is non-printing, it will normally be
2429           displayed in hexadecimal. This setting will force octal display.
2430           Non-printing characters whose 8th bit is not set are always
2431           displayed in control character (e.g. '^C') notation. (W)
2432
2433   video-attrs
2434           Overlay all text with the given attribute: bold, italic, reverse,
2435           underline or none. (U)
2436
2437   view
2438           View the file only. No changes are permitted. (B)
2439
2440   view-on-readonly (viewro)
2441           Causes "view" mode to be set for read-only files. (U)
2442
2443   visual-matches
2444           When a search command is executed, the cursor will move as usual.
2445           In addition, all matching occurrences of the searched-for pattern
2446           (in the current buffer) will be emphasized according to the value
2447           of this mode: "none", "underline", "bold", "italic", or "reverse".
2448           Additionally, on systems which support color, this mode may be
2449           used to set the text foreground color using any of the color
2450           values.
2451
2452           The '=' command can be used to clear this sort of highlighting,
2453           until the next search is done for a different pattern. Note that
2454           setting this mode can significantly slow down the editor's
2455           operation when complex or frequently occurring patterns are used,
2456           since vile will need to scan the entire buffer for matches on any
2457           change to the buffer. (B)
2458
2459   vtflash
2460           If your terminal does not support a visual flash feature, but does
2461           support the DECSCNM control sequences that toggle normal/inverse
2462           screen video (a feature available with vt100 and later terminals),
2463           then a visual bell effect may be achieved using this mode.
2464
2465           +----------------------------------------------------------------+
2466           | Mode Value | Mode Semantics                                    |
2467           |------------+---------------------------------------------------|
2468           | off        | feature disabled (default)                        |
2469           |------------+---------------------------------------------------|
2470           | reverse    | on err -> switch screen to normal then reverse    |
2471           |            | video.                                            |
2472           |------------+---------------------------------------------------|
2473           | normal     | on err -> switch screen to reverse then normal    |
2474           |            | video.                                            |
2475           +----------------------------------------------------------------+
2476
2477           As is true with "flash" mode, no audible or visible indication
2478           will occur at all if "errorbells" mode is not set on. (U)
2479
2480   warn-blanks
2481           When prompted for a filename, vile normally allows you to use
2482           leading and trailing blanks and other nonprinting characters. Set
2483           this mode if you prefer to be prompted. Vile will then prompt you
2484           if you want the nonprinting characters to be stripped from the
2485           given filename. (U)
2486
2487   warn-rename
2488           When using ":e" to find a file that has the same name as another
2489           buffer, vile will normally offer for you to edit the proposed
2490           alternate name for the buffer constructed by adding a "-1", "-2",
2491           etc. to the end of the name. Turning off "warn-rename" will make
2492           vile choose buffer names without user intervention. (U)
2493
2494   warn-reread
2495           When using ":e!" to reread a buffer from the file on disk, vile
2496           will normally warn you that you are about to clobber a modified
2497           buffer. Turning off "warn-reread" mode will make vile assume you
2498           know what you are doing. (U)
2499
2500   warn-unread
2501           When leaving the editor, if not all buffers have been "visited",
2502           then normally vile will complain, and remind the user to use
2503           ":q!". Turning off "warn-unread" mode will suppress this behavior.
2504           (U)
2505
2506   working
2507           If turned off (noworking), will suppress the activity indicator
2508           ("working..."/"...working") which appears during long-running
2509           operations. (U)
2510
2511   wrapmargin (wm)
2512           Implements vi's auto-wrap mode. vile computes the effective margin
2513           from the mode's value:
2514              * if positive, the wrapmargin specifies the number of columns
2515                on the screen's right margin to reserve before breaking the
2516                input lines on a preceding space.
2517              * if negative, vile counts from the left margin.
2518              * if zero (default), this mode is inactive.
2519
2520           A value of 5 and an 80 column screen will result in 75 character
2521           lines. This mode is different from the "wrapwords" mode (below)
2522           which uses the "fillcol" setting as its target column. The two
2523           modes probably should not both be used at once. (B)
2524
2525   wrapscan (ws)
2526           Text searches will continue from past the bottom of the file to
2527           the top, and vice-versa. (B)
2528
2529   wrapwords (ww)
2530           Similar to, but different from, vi's auto-wrap mode (i.e.
2531           "wrapmargin"). While inserting, words are moved to the next line
2532           if the current line gets too long. Wrapping is only attempted when
2533           a space is typed. The target maximum width of lines is changed
2534           with the "fillcol" setting. (B)
2535
2536   xterm-fkeys
2537           Support xterm's modified function keys by generating system
2538           bindings for the shift-, control-, alt-modifiers of each function
2539           key listed in the terminal description.
2540
2541   xterm-mouse
2542           Enables mouse-clicking if you are running within an xterm. That
2543           is, it allows vile to receive mouse events. Since this mode
2544           overrides xterm's cut & paste, you will need to use the Shift key
2545           when pressing the mouse buttons to cut and paste between X
2546           windows. Your TERM variable's termcap entry should contain the
2547           string "xterm" for this to work. (U)
2548
2549   xterm-title
2550           Enables titlebar updates if you are running within an xterm. Each
2551           time you switch to a different buffer, vile can update the title.
2552           This uses the same tests of the TERM variable as the xterm-mouse
2553           mode. (U)
2554
2555   yankmotion (ym)
2556           Yanking text will cause cursor movement (just like vi) if the
2557           motion is left or up. (B)
2558
25598-Bit Operation
2560
2561   vile allows input, manipulation, and display of all 256 possible byte-wide
2562   characters. Wide characters are supported, depending on the device type
2563   and your locale settings.
2564
2565  Output
2566
2567   By default, 8-bit characters with the high bit set (decimal value 128 or
2568   greater) will display as hexadecimal (or octal; see "unprintable-as-octal"
2569   above) sequences, e.g. \xA5. A range of characters which should display as
2570   themselves (that is, characters understood by the user's display terminal)
2571   may be given using the "printing-low" and "printing-high" settings (see
2572   above). Useful values for these settings are 160 and 255, which correspond
2573   to the printable range of the ISO-Latin-1 character set.
2574
2575   If your locale (e.g., the LANG or LC_CTYPE environment variable on a POSIX
2576   platform) is configured properly, the "printing-low" and "printing-high"
2577   settings are not needed. vile initializes its character type tables based
2578   on the system. You can make finer adjustments to those tables as described
2579   in "Character Classes".
2580
2581   If your terminal (and locale) are set up to support UTF-8, vile can
2582   display files which use that encoding. It can also display UTF-16 and
2583   UTF-32 files using UTF-8. When the terminal/locale do not support UTF-8
2584   vile displays the wide characters as hexadecimal codes, e.g., \u1234. Even
2585   when vile can display wide characters, you can force it to display the
2586   hexadecimal codes with the "unicode-as-hex" mode.
2587
2588   See UTF-8 Support versus Driver in config.doc for an overview of the
2589   terminal drivers.
2590
2591   If your terminal and locale are not set up to support UTF-8, vile displays
2592   UTF-8 codes that would map to Latin-1 (8-bit) values with a "\?" rather
2593   than "\x" prefix, to distinguish them from ordinary 8-bit values. It will
2594   also display this form for bytes found in UTF-8 files that cannot be
2595   decoded as UTF-8.
2596
2597  Input
2598
2599   There are basically three ways of getting 8-bit characters into a vile
2600   buffer:
2601
2602   Directly -
2603           if the user's input device (i.e. the terminal or xterm) can
2604           generate all characters, and if the terminal settings are such
2605           that these characters pass through unmolested, then vile will
2606           happily incorporate them into the user's text, or act on them if
2607           they are bound to functions. On an xterm, try "stty cs8 -parenb
2608           -istrip". Real serial lines may take more convincing, at both
2609           ends, but use that stty command as a starting point.
2610
2611           If you start vile in a locale that uses UTF-8 encoding, vile will
2612           check if there is a corresponding 8-bit encoding by stripping the
2613           UTF-8 suffix from the locale name, e.g., "en_US.UTF-8" to "en_US".
2614           When reading characters from the keyboard, it will map 8-bit codes
2615           to the 8-bit locale when editing a buffer whose file-encoding is
2616           "8bit" or "ascii".
2617
2618   As numbers -
2619           the ^V prefix (or, more correctly, the key bound to the
2620           "quote-next-character" function), if followed by up to three
2621           digits, will insert a character whose value is that number (no
2622           greater than 255) into the buffer. The number may be entered in
2623              * decimal (^VNNN),
2624              * octal with a leading '0' (^V0NNN) or
2625              * hexadecimal with a leading 'x' (^VxNN).
2626
2627           Wide (Unicode) values can be entered in a similar fashion, though
2628           they are stored as more than one byte:
2629
2630              * Unicode hexadecimal with a leading 'u' (^VuNNNN).
2631              * Unicode decimal with a leading 'U' (^VuNNNN).
2632
2633           If the current buffer's "file-encoding" mode is set to one of the
2634           Unicode flavors (utf-8, utf-16 or utf-32), vile will display the
2635           value as a wide character. Otherwise it will show the bytes of the
2636           corresponding UTF-8 encoding.
2637
2638   As digraphs -
2639           Perhaps more useful to some people is using a set of ":map!"
2640           commands to aid insertion of 8-bit text. The file "digraphs.rc"
2641           distributed with the vile source contains a set of mappings which
2642           should aid the input of ISO 8859/1 text. As examples, the mappings
2643           in digraphs.rc allow one to type ^KU" or ^Ku" to get an umlaut
2644           character, ^K12 to get the little '1/2' symbol, ^KY- to get the
2645           Yen currency symbol, or ^K:- to get an arithmetic division symbol.
2646
2647   Users who have no need to enter 8-bit text may want access to the
2648   meta-bound functions while in insert mode as well as command mode. The
2649   mode "meta-insert-bindings" controls whether functions bound to meta-keys
2650   (characters with the high bit set) are executed only in command mode, or
2651   in both command and insert modes. In either case, if a character is _not_
2652   bound to a function, then it will be self-inserting when in insert mode.
2653   (To bind to a meta key in the .vilerc file, one may specify it as itself,
2654   or in hexadecimal or octal, or with the shorthand 'M-c' where c is the
2655   corresponding character without the high bit set.
2656
2657   (Although it is possible to edit and view all 256 characters, it is
2658   currently impossible to _search_ for a string that contains the NULL
2659   character, since this is used internally to terminate the search string.)
2660
2661
2662Command History
2663---------------
2664   You may scroll through the list of previous replies to the :-prompt by
2665   using the up- or down-arrow special keys on your keyboard (if your
2666   configuration supports it).
2667
2668   Vile prompts for commands in parts, and stores a copy of the complete
2669   command in the [History] buffer. For example, you may type
2670
2671         :g/help/p
2672
2673   and vile will prompt for the parts after each delimiter, e.g.,
2674
2675         global pattern: help
2676         action to perform on each matching line: p
2677
2678   The [History] buffer, shown with "show-history" will store
2679
2680         g/help/p
2681
2682   At each prompt, using the up/down arrows will tell vile to display the
2683   corresponding result for the "same" command. If [History] contains
2684
2685         g/take/g
2686         g/help/p
2687
2688   then the up/down arrows will show "take" or "help", skipping commands
2689   which do not begin with "g/".
2690
2691
2692Editing the Minibuffer
2693----------------------
2694   The minibuffer (i.e., the last line on the screen, aka the :-prompt) can
2695   be edited using arrow keys, the delete character, or by toggling to
2696   vi-mode with the ^G (mini-edit) character. In mini-edit mode, you may use
2697   commands that do not move the cursor to a different line, as well as the
2698   following editing commands: i, a, I, A.
2699
2700   Vile treats the minibuffer specially. Completed lines are written to the
2701   history buffer. When scrolling up/down in the command history, vile
2702   displays the data that correspond to the command which you have entered,
2703   e.g., a :set command will display the variables entered for preceding :set
2704   commands.
2705
2706
2707Special Character Expansion
2708---------------------------
2709   As in vi, the % and # characters typed while responding to a prompt will
2710   expand to the current or "alternate" filename.
2711
2712   Also as in vi, the ~ character will expand to be the previous replacement
2713   pattern when entering either a replacement or search pattern,
2714
2715   In addition, the colon character (":") expands at most prompts to be the
2716   identifier name under the cursor.
2717
2718   Expansion of ! to the last command run is implemented, but only when a
2719   shell command is being entered.
2720
2721   Any of these expansions can be suppressed by prefixing with a '\'.
2722
2723
2724Character Classes
2725-----------------
2726   The "show-printable" command shows a table of the characters and their
2727   classes, e.g., printable, punctuation, etc.
2728
2729   You may modify the characters in (or corresponding to) the narrow local in
2730   this table by setting or unsetting a given class for a range of
2731   characters. The commands which do this are "set-char-class" and
2732   "delete-char-class" or "unset-char-class".
2733
2734   These commands expect the class name and a regular expression which
2735   defines a range of characters. The class names (short to allow
2736   "show-printable" to show everything in 80 columns) are
2737
2738   +------------------------------------------------------------------------+
2739   | Short          | Long Description                                      |
2740   |----------------+-------------------------------------------------------|
2741   | arg            | ex-style line range: 1,$ or 13,15 or % etc.           |
2742   |----------------+-------------------------------------------------------|
2743   | ctl            | [:cntrl:] control character                           |
2744   |----------------+-------------------------------------------------------|
2745   | del            | delete/backspace                                      |
2746   |----------------+-------------------------------------------------------|
2747   | fn             | fence character, e.g., "{" or "}"                     |
2748   |----------------+-------------------------------------------------------|
2749   | id             | [:ident:] normal identifier, used for word boundaries |
2750   |----------------+-------------------------------------------------------|
2751   | lwr            | [:lower:] lowercase, e.g., "a"                        |
2752   |----------------+-------------------------------------------------------|
2753   | nsp            | [:graph:] nonspace                                    |
2754   |----------------+-------------------------------------------------------|
2755   | num            | [:digit:] digit, e.g., "0"                            |
2756   |----------------+-------------------------------------------------------|
2757   | path           | [:file:] file/path name                               |
2758   |----------------+-------------------------------------------------------|
2759   | prn            | [:print:] printable                                   |
2760   |----------------+-------------------------------------------------------|
2761   | pun            | [:punct:] punctuation                                 |
2762   |----------------+-------------------------------------------------------|
2763   | qid            | qualified identifiers, used in tags parsing           |
2764   |----------------+-------------------------------------------------------|
2765   | sh             | may appear in shell/pipe                              |
2766   |----------------+-------------------------------------------------------|
2767   | sp             | [:blank:] space                                       |
2768   |----------------+-------------------------------------------------------|
2769   | tmp            | legal in scratch-buffer names                         |
2770   |----------------+-------------------------------------------------------|
2771   | upr            | [:upper:] uppercase, e.g., "A"                        |
2772   |----------------+-------------------------------------------------------|
2773   | wld            | shell wildcard, e.g., "*"                             |
2774   +------------------------------------------------------------------------+
2775
2776   You can also reset the table to its initial state using
2777   "reset-char-classes".
2778
2779
2780Key Rebinding
2781-------------
2782   There is a key rebinding facility (if vile is built to include it), which
2783   is invoked as follows. One must know the "english" name for the command
2784   being rebound. Use ":show-commands" or ":apropos string" to find english
2785   names containing "string". Then use the command:
2786
2787     :bind-key <englishname> <keyseq>
2788
2789   where keyseq is the exact keyboard sequence (i.e. single character, or
2790   '^X', '^A', or '#' followed by a single character) to which the command
2791   should be bound. In a .vilerc file, keyseq can be either the literal
2792   sequence, or the printable representation of the sequence, e.g. ^A-a or
2793   ^X-S. (A summary of how key-sequences can be represented appears at the
2794   end of this section.)
2795
2796   For configurations that permit it (X and win32, not termcap/terminfo), you
2797   may also specify a key modifier, i.e., "alt+", "ctrl+" or "shift+". The
2798   modifier follows the ^A or ^X prefix, e.g.,
2799
2800         shift+#6
2801
2802   for shifted function-key 6.
2803
2804   Commands can also be bound to meta keys, which are regular ASCII
2805   characters with the eighth bit (0x80) bit set. The "printable" form for
2806   these keys is 'M-c'.
2807
2808   Commands bound to '#-c' or 'FN-c' key sequences are usually also available
2809   by using the function keys on the terminal. Thus the up-arrow function key
2810   can be bound to as '#-A' or 'FN-A'. Use show-key-names to see a complete
2811   list of these key sequences.
2812
2813   Even the ^A and ^X prefix characters can be rebound, using the dummy
2814   functions "cntl_a-prefix" and "cntl_x-prefix", and the '#' key itself can
2815   be rebound - it is represented by the command name "function-prefix".
2816
2817   Examples: To cause the / and ? commands to perform incremental searches,
2818   use:
2819
2820     bind-key incremental-search /
2821     bind-key reverse-incremental-search ?
2822
2823   To make ^N and ^P switch windows instead of cause motion by lines, try:
2824
2825     bind-key next-window ^N
2826     bind-key previous-window ^P
2827
2828   To cause the space bar to move forward by pages, as in the "more" command,
2829   use:
2830
2831     bind-key next-page \s
2832
2833   (Space and tab can be represented with: "\s" and "\t".)
2834
2835   Note that when interactive, ^A and ^X are typed using the control key. In
2836   a file, however, they can be either a caret (^) followed by a letter, or
2837   the literal control key. In the latter case you would not use the '-'
2838   separator. So ^A-x as four distinct characters could also be entered as
2839   ^Ax, which would only be two characters.
2840
2841   Characters can be entered in hexadecimal or octal as well, in the form
2842   0xNN, where NN is exactly two hexadecimal digits. If you know the
2843   hexadecimal value for a key, you can bind to it like:
2844
2845     bind-key next-window ^A-\x14
2846
2847   or
2848
2849     bind-key next-window #-\213
2850
2851   The sequence 'M-', represents a "meta-key", or a "meta" character. It is
2852   equivalent to setting the high bit of the following character, so 'M-e' is
2853   has the value of (0x80|0x65), or 0xe5.
2854
2855  Insert mode:
2856
2857   Function and meta-key bindings are available in insert mode, as well as in
2858   command mode. (But only via either the "meta bit" or 'FN' sequence form -
2859   the '#' prefix will not work in insert mode.) There are four key binding
2860   tables:
2861
2862   default -
2863           for commands in screen mode as well as those that do not fit
2864           naturally into one of the specialized modes. This is initialized
2865           by compiled-in definitions for normal (0-127) and special
2866           (function and meta-key) definitions.
2867
2868         bind-key
2869         describe-all-keys
2870         describe-bindings
2871         describe-key
2872         unbind-key
2873
2874   cmdmode -
2875           for command editing. This is initialized with the special keys
2876           from the default table, as well as the control characters that are
2877           associated with movement, e.g., ^N and ^P.
2878
2879         bind-cmdmode-key
2880         describe-all-cmdmode-keys
2881         describe-cmdmode-key
2882         show-cmdmode-bindings
2883         unbind-cmdmode-key
2884
2885   insmode -
2886           for insertion. This is initialized with the special keys from the
2887           default table, as well as the control characters that are
2888           associated with movement, e.g., ^N and ^P. The insert-exec mode
2889           controls whether those control characters are interpreted or
2890           inserted.
2891
2892         bind-insmode-key
2893         describe-all-insmode-keys
2894         describe-insmode-bindings
2895         describe-insmode-key
2896         unbind-insmode-key
2897
2898   selmode -
2899           for selection highlighting, i.e., multimotion. This is initially
2900           the same as the default binding table, but may be customized.
2901
2902         bind-selmode-key
2903         describe-all-selmode-keys
2904         describe-selmode-bindings
2905         describe-selmode-key
2906         unbind-selmode-key
2907
2908   The "describe-all-*keys" commands differ from the display-commands in each
2909   group. They show for each of the 256 character codes which normal
2910   (unmodified) or ^A/^X (modified) keys are bound to a given function. Use a
2911   repeat count before those commands to show data for all 256 codes.
2912
2913   The following macro will work correctly in both command and insert modes.
2914   Note that you must specify the insert mode (insmode) binding separately;
2915   default bindings are not inherited automatically because they may conflict
2916   with the bindings used for exiting or modifying text within insert mode.
2917
2918     store-procedure begin-errtext
2919             insert-string "fprintf(stderr, \""
2920             set-named-mark z
2921             insert-string "\\n\");\n"
2922             goto-named-mark-exact z
2923             ; enter insert mode if we weren't already there
2924             ~if &seq $mode "command"
2925                     insert-chars
2926             ~endif
2927     ~endm
2928     ; bind to function key 5
2929     bind-key begin-errtext FN-5
2930     bind-insmode-key begin-errtext FN-5
2931     ; also bind to meta-A
2932     bind-key begin-errtext M-A
2933     bind-insmode-key begin-errtext M-A
2934
2935   Actually the "meta-insert-bindings" setting controls whether meta-keys
2936   will have their bound effect when in insert mode. If this setting is not
2937   on (or if the meta-key is not bound to any function) then the key's value
2938   will simply be inserted into the buffer.
2939
2940  Syntax for key-sequences:
2941
2942   To summarize, a key-sequence being bound to is specified with:
2943
2944    1. an optional prefix, like this:
2945
2946       ^A- (three chars)
2947       ^X- (three chars)
2948       ^A (one char)
2949       ^X (one char)
2950
2951    2. followed by an optional "function" prefix:
2952
2953       #- (two chars) or
2954       FN- (three chars)
2955
2956    3. followed by an optional "meta" prefix:
2957
2958       M- (two chars)
2959       (this is the same as with specifying a character in that has the high
2960       bit set)
2961
2962    4. followed by a character, like this:
2963
2964       C (one char)
2965       ^C (one char)
2966       ^C (two chars)
2967       \NNN (max of four chars, where NNN are octal digits)
2968       \xNN (max of four chars, where NN are hex digits)
2969       \n,\r,\t,\b,\f,\a (two chars each, usual meanings)
2970       \e (two chars, means ESC)
2971       \s (two chars, means SPACE)
2972
2973   (The "one char" control character entries in the above table are
2974   represented in this help file as two printable characters, to ensure they
2975   are not deleted by mailers or file transfer programs.)
2976
2977  Function Keys
2978
2979   When you bind to a function key, you will see its value printed as a
2980   'poundsign' sequence. And, if you wish to :map a function key, you will
2981   need to use its poundsign sequence. This is explained more fully below.
2982
2983   The list of function key labels, along with their "vile name", are as
2984   follows:
2985
2986   +------------------------------------------------------------------------+
2987   | Usual Label      | Vile name       | Usual Label      | Vile name      |
2988   |------------------+-----------------+------------------+----------------|
2989   | Up-arrow         | #A              | Home             | #H             |
2990   |------------------+-----------------+------------------+----------------|
2991   | Down-arrow       | #B              | End              | #E             |
2992   |------------------+-----------------+------------------+----------------|
2993   | Left-arrow       | #D              | Insert           | #i             |
2994   |------------------+-----------------+------------------+----------------|
2995   | Right-arrow      | #C              | Delete           | #d             |
2996   |------------------+-----------------+------------------+----------------|
2997   | Prior (PageUp)   | #p              | Find             | #f             |
2998   |------------------+-----------------+------------------+----------------|
2999   | Next (PageDown)  | #n              | Select           | #s             |
3000   |------------------+-----------------+------------------+----------------|
3001   | Help             | #?              | Menu             | #m             |
3002   |------------------+-----------------+------------------+----------------|
3003   | F1               | #1              | F12              | #@             |
3004   |------------------+-----------------+------------------+----------------|
3005   | F2               | #2              | F13              | ##             |
3006   |------------------+-----------------+------------------+----------------|
3007   | F3               | #3              | F14              | #$             |
3008   |------------------+-----------------+------------------+----------------|
3009   | F4               | #4              | F15              | #%             |
3010   |------------------+-----------------+------------------+----------------|
3011   | F5               | #5              | F16              | #^             |
3012   |------------------+-----------------+------------------+----------------|
3013   | F6               | #6              | F17              | #&             |
3014   |------------------+-----------------+------------------+----------------|
3015   | F7               | #7              | F18              | #*             |
3016   |------------------+-----------------+------------------+----------------|
3017   | F8               | #8              | F19              | #(             |
3018   |------------------+-----------------+------------------+----------------|
3019   | F9               | #9              | F20              | #)             |
3020   |------------------+-----------------+------------------+----------------|
3021   | F10              | #0              | F11              | #!             |
3022   |------------------+-----------------+------------------+----------------|
3023   | KeyPad_F1        | #P              | KeyPad_F3        | #R             |
3024   |------------------+-----------------+------------------+----------------|
3025   | KeyPad_F2        | #Q              | KeyPad_F4        | #S             |
3026   +------------------------------------------------------------------------+
3027
3028   In addition, #M, #t, and #T are used internally to support mouse
3029   operations in an xterm. To undo the relationship between a
3030   "system-defined" function key and the poundsign sequence it produces, use
3031   ":unmap-system-chars".
3032
3033  :map, :map!, :noremap, :noremap!
3034
3035   The vi "map" and "map!" commands are implemented in vile. As in vi,
3036   mapping works best if the character sequence being bound corresponds to
3037   pressing a single key. Multiple key sequences will work as long as the
3038   next key in the sequence is pressed within a specified number of
3039   milliseconds. The value of "timeoutlen" is used for system-defined
3040   character sequences, i.e. function keys. User defined sequences will use
3041   this too, unless the value of "timeoutlen-user" is non-zero, in which case
3042   this value will be used instead.
3043
3044   Because "map" and "map!" may be used to remap arbitrary sequences, these
3045   sequences must be entered literally, i.e, the syntax for key sequences as
3046   listed above will not work for "map" and "map!". To enter control
3047   characters into a .vilerc file, use the ^V escaping mechanism. A map
3048   command entered from the command line will require fewer characters be
3049   escaped with ^V.
3050
3051   To provide a relatively portable way of specifying function key mappings,
3052   vile will reapply mapping to the result of a system-defined map. System
3053   function keys are mapped to "poundsign" sequences, like '#1' for function
3054   key 1, and '#B' for the down-arrow key. The remapping allows one to put
3055
3056     map #1 <some-user-map-sequence>
3057
3058   in the .vilerc file, and have the user-sequence executed when the system
3059   F1 key is pressed. (Otherwise the terminal-specific sequence would have to
3060   appear in the .vilerc.) See the section on "Function Keys" above for a
3061   full list.
3062
3063   The "remap" option controls whether the successfully mapped result of a
3064   map is reevaluated for more mapping matches. The "noremap" (and
3065   "noremap!") variants of the map commands will force that particular
3066   mapping to be applied without subsequent remapping, regardless of the
3067   current setting of the global "remap" setting.
3068
3069   Since key sequences starting the '^X', '^A', or '#' prefixes are normally
3070   expected to act as a unit, no remapping is done on characters that follow
3071   such prefixes. For instance, this keeps a map like:
3072
3073     :map h ihello<ESC>
3074
3075   from breaking the '^X-h' command.
3076
3077   Long running loops caused by recursive :map definitions are detected and
3078   assumed to be infinite. When such a loop is detected, execution is
3079   aborted. Turning off the "remap" option, or doing some of the maps with
3080   the ":noremap/:noremap!" form of the map commands will eliminate most such
3081   loops.
3082
3083   vile normally duplicates real vi's behavior (but not vim's) in that the
3084   first character of the sequence being mapped to is not subject to
3085   recursive (map) evaluation. Assuming "remap" is on, pressing 'j' when
3086   ":map j jh" is in effect will not cause an infinite loop, whereas ":map j
3087   hj" _will_ cause such a loop. Setting the "remapfirst" option will allow
3088   this sort of remapping (and will cause an infinite loops for both
3089   examples).
3090
3091   The "maplonger" option controls whether the longer or shorter of two
3092   "nested" map strings will be favored by the editor. That is, if both "foo"
3093   and "foobar" are mapped (to presumably different values), then with
3094   "maplonger" set, vile will not expand "foo" until it is sure (either
3095   because the next character is not 'b', or a timeout has expired) that
3096   "foobar" will not be seen. Real vi will always expand "foo" immediately,
3097   and this is the default behavior. Though not particularly recommended, the
3098   "maplonger" mechanism even permits the following types of mappings:
3099
3100     :map z j
3101     :map zz k
3102
3103   When 'z' is pressed by itself it will cause vile to move down one line
3104   (assuming j has not been rebound or remapped). But if 'z' is pressed twice
3105   rapidly (enough) in succession, vile will move to the previous line.
3106
3107   The left hand side of a map[!] definition may contain the usual backslash
3108   escapes: \n, \r, \t, \b, \f, \a (^G), \e (ESC), \s (SPACE), \xNN
3109   (hexadecimal), \NNN (octal). The right hand side is taken exactly
3110   literally, so special characters must be expressed as themselves.
3111
3112   The current set of mappings or "map!"ings may be viewed with the commands
3113   ":map<cr>" (or ":show-mapped-chars") or ":map!<cr>" (or
3114   ":show-mapped!-chars").
3115
3116   The system-defined maps, representing the function keys, may be shown with
3117   ":show-system-mapped-chars".
3118
3119   To undo a mapping, use "unmap", "unmap!", or "unmap-system-chars".
3120
3121  :abbr
3122
3123   The "abbr" command is also present in vile. It is similar to, but slightly
3124   different than, "map!". Whereas "map!" examines characters as they are
3125   typed, continuously looking for a match against the stored translation
3126   strings, the "abbr" command examines them after they are already in the
3127   buffer, and is more sensitive to their surrounding context.
3128
3129   First, abbreviations are never expanded unless followed by non-"word"
3130   characters. In addition, abbreviations which begin like a "word" (i.e.
3131   with letters, digits, or the '_' character) are not expanded if they
3132   immediately follow another "word" character - they must follow whitespace
3133   or punctuation or the beginning of the line. Likewise, abbreviations that
3134   begin with a punctuation character are not detected within more
3135   punctuation - they must follow whitespace or a "word", or the beginning of
3136   the line.
3137
3138   If the "backspacelimit" setting is set (and it is, by default), then
3139   characters not inserted during the current insertion command are not
3140   considered in the above comparisons - the start of the current insertion
3141   behaves much like the beginning of line in that case.
3142
3143   Abbreviations are never recursive.
3144
3145   vile is more lenient than vi regarding what is a valid abbreviation. vi
3146   insists that an abbreviation be all "word" characters, or be all
3147   "non-word" characters, except for the last character, which _must_ be a
3148   "word" character. vile allows anything at all to be abbreviated, only
3149   enforcing the expansion rules mentioned above.
3150
3151   To undo an abbreviation, use "unabbreviate".
3152
3153
3154Special "Terminal" Key Rebinding
3155--------------------------------
3156   In addition to the above binding mechanism for vile commands, other
3157   keystrokes to the editor are rebindable using the "set-terminal" command.
3158   These keystrokes are mostly derived directly from the user's tty settings
3159   on entering the editor, but there are a couple of additions related to
3160   command and filename completion.
3161
3162   The values of these characters can be shown with the "show-terminal"
3163   command, and can be changed with the "set-terminal" command.
3164
3165   +------------------------------------------------------+
3166   | Name             | Default value     | Typical value |
3167   |------------------+-------------------+---------------|
3168   | backspace        | from tty settings | (DEL or ^H)   |
3169   |------------------+-------------------+---------------|
3170   | interrupt        | from tty settings | (^C or DEL)   |
3171   |------------------+-------------------+---------------|
3172   | line-kill        | from tty settings | (^U or @)     |
3173   |------------------+-------------------+---------------|
3174   | mini-edit        | (^G)              |               |
3175   |------------------+-------------------|               |
3176   | name-complete    | <tab>             |               |
3177   |------------------+-------------------+---------------|
3178   | quote-next       | from tty settings | (^V)          |
3179   |------------------+-------------------+---------------|
3180   | start-output     | from tty settings | (^Q)          |
3181   |------------------+-------------------+---------------|
3182   | stop-output      | from tty settings | (^S)          |
3183   |------------------+-------------------+---------------|
3184   | suspend          | from tty settings | (^Z)          |
3185   |------------------+-------------------+---------------|
3186   | test-completions | ?                 |               |
3187   |------------------+-------------------+---------------|
3188   | word-kill        | from tty settings | (^W)          |
3189   +------------------------------------------------------+
3190
3191
3192Flow-control
3193------------
3194   Historically, the flow of data between the computing host and the user's
3195   terminal was throttled through the use of special characters in the input
3196   stream, known as XON and XOFF (whose values are ^Q and ^S respectively).
3197   Most modern systems do not need these characters, and regulate the flow in
3198   an "out-of-band" manner. The terminal device driver, however, is usually
3199   still set up with software flow control enabled, to allow the user to
3200   manually start and stop output with the ^S and ^Q characters.
3201
3202   vile normally resets the driver to allow the ^S and ^Q characters to be
3203   bound to commands, since most systems no longer need software flow
3204   control, and since there is usually no reason for a user to wish to
3205   suspend output when running vile. Some older devices (usually older slower
3206   terminals), however, still need to be able to automatically control the
3207   data flow by generating ^S/^Q without the user's intervention.
3208
3209   To accommodate these situations, the "flow-control-enable" command will
3210   reset the terminal driver to its original state. Software flow-control
3211   will be re-enabled, and commands bound only to the ^S and ^Q characters
3212   will be inaccessible. The characters affected in this way may be seen with
3213   the "show-terminal-chars" command, where they will appear as the
3214   "start/stop-output" characters. The action of the "flow-control-enable"
3215   command will be reversed if it is given any argument.
3216
3217
3218Recorded macros
3219---------------
3220   The first type of macro in vile is for temporary, quick macro usage, and
3221   lets you record a set of keystrokes as you execute vile commands. You can
3222   then replay those keystrokes with a single key.
3223
3224   ^X-(
3225
3226   ^X-)
3227           Begin or end the recording a keyboard macro. The keystrokes you
3228           type are recorded. For compatibility with previous versions of
3229           vile (where separate commands were necessary), these two commands
3230           are now both bound to the same function. The start/stop capability
3231           is now a toggle, and requires only one command.
3232
3233   ^X-&
3234           Execute the keyboard macro.
3235
3236   ^X-^
3237           Copy recorded keyboard macro to a named register, for saving, or
3238           for execution using '@a', as below. (Type "a^X^, where "a means
3239           yank into register-a)
3240
3241   The vi '@' command is present as well, and can be used to execute the
3242   contents of a named register as if it were entered at the keyboard. To
3243   make this more useful, the "load-register" command will allow preloading a
3244   named register, from .vilerc file. For example:
3245
3246     use-register a load-register ihello^[
3247
3248   will load register 'a' with a command to insert the word "hello". (The ^[
3249   should be a real ESC character, entered by preceding it with ^V.) A better
3250   example, is this:
3251
3252     use-register w load-register ":!chmod +w %^M:w^M"
3253
3254   which makes the current file writable and writes it. (Again, use ^V to get
3255   the CR characters into the .vilerc file.)
3256
3257
3258Programmed procedures (aka macros)
3259----------------------------------
3260   [ Note 1: the information presented in this section of the help file is a
3261   subset of "doc/macros.doc", which is supplied with the vile source code.
3262   macros.doc is the authoritative reference manual for the editor's macro
3263   language.
3264
3265   Note 2: the language features/directives described below are not limited
3266   solely to use within macros. These directives are often used within a
3267   startup/command file to configure the editor, load registers, etc. ]
3268
3269   vile can also be extended by defining macros and optionally binding the
3270   execution of those macros to key sequences. For instance, if the following
3271   lines appear in a .vilerc file:
3272
3273     1 store-macro
3274             5 delete-til next-word
3275     ~endm
3276     bind-key execute-macro-1 ^A-1
3277
3278   then when ^A-1 is executed, 5 words will be deleted. The "-til" suffix on
3279   an englishname denotes that it is a vi operator style command, and expects
3280   to be followed by a motion command. Also,
3281
3282     1 store-macro
3283             5 delete-til lines
3284     ~endm
3285
3286   would be the equivalent of "5dd" since the word "lines" represents the
3287   stuttered 'dd' style of operation. More examples are given throughout this
3288   help file.
3289
3290   Macros come in two flavors: named and numbered. The syntax and advantages
3291   of each format are discussed next.
3292
3293  Numbered macros
3294
3295   The numbered macro syntax looks like so:
3296
3297     <number> store-macro
3298             <language element>
3299             ...
3300             <language element>
3301     ~endm
3302
3303   A numbered macro is executed using this command:
3304
3305     execute-macro-<number>
3306
3307   To bind a keystroke to this macro, use this command:
3308
3309     bind-key execute-macro-<number> <keystroke>
3310
3311   The only advantage of numbered macros over named macros is that the former
3312   do not share the same namespace as vile's commands. This attribute can be
3313   advantageous when creating macros recalled solely via key bindings.
3314
3315   Note that numbered macros are allocated from a fixed pool (default is 40
3316   macros). This fixed limit can be changed during the editor's
3317   configuration. Given their fixed allocation and the fact that their
3318   strictly numeric "names" don't facilitate easy recall, numbered macros are
3319   not used that much anymore.
3320
3321  Named macros
3322
3323   A named macro, aka "stored procedure", uses this syntax:
3324
3325     store-procedure <unique-name>
3326             <language element>
3327             ...
3328             <language element>
3329     ~endm
3330
3331   where:
3332
3333   unique-name
3334           is an alphanumeric identifier that does not conflict with the name
3335           of any existing editor command (the show-commands command
3336           generates a list of all existing commands).
3337
3338   A stored procedure is executed by simply referencing its name. To bind a
3339   keystroke to this macro, use this command:
3340
3341     bind-key <unique-name> <keystroke>
3342
3343   Here's a trivial example:
3344
3345     store-procedure write-msg-tst
3346             write-message "this is a test macro"
3347     ~endm
3348     bind-key write-msg-tst #h
3349
3350   Two mechanisms now exist for executing this macro:
3351
3352     * press "#h" within the editor, or
3353     * simply use the name "write-msg-tst" as if it were any other built-in
3354       editor command. This means that "write-msg-tst" can be invoked from
3355       another macro, from a startup/configuration file, or from vile's
3356       command line, like so:
3357
3358         :write-msg-tst
3359
3360   Note that named macros may also include parameters and a help string, each
3361   of which are described in doc/macros.doc.
3362
3363  User-defined Operators
3364
3365   These are defined using the store-operator command, and accept no
3366   arguments. Otherwise they are much like other named macros. These macros
3367   setup parameters and perform special processing wrapped around one of
3368   vile's built-in operators. Here is an example:
3369
3370     store-operator fmt
3371             $cmd-count filter-til $cmd-motion 'fmt -w50 -'
3372     ~endm
3373
3374   In the example, the combination of $cmd-count and $cmd-motion (passed into
3375   the macro) act as the "real" operator's associated motion.
3376
3377  Macro Language Elements
3378
3379   Macros may incorporate any of the editor's built-in commands, directives
3380   (e.g., ~if, ~else), any previously defined named or numbered macro,
3381   functions (e.g., &error, &sequal), and variables.
3382
3383  Variables
3384
3385   There are some built-in variables that can be used in macros to gain
3386   access to parts of vile status, and parts of the current buffer. Built-in
3387   variables are accessed by name, prefixed with the '$' character. There are
3388   two types of built-in variables (the so-called "state" variables, and mode
3389   values). The state variables are: shown in the table below.
3390
3391   You can also show a summary using the "describe-state-variables" command:
3392
3393   +------------------------------------------------------------------------+
3394   | Name                | Description                                      |
3395   |---------------------+--------------------------------------------------|
3396   | $_                  | most-recent macro $return value                  |
3397   |---------------------+--------------------------------------------------|
3398   | $abufname           | alternate buffer name (i.e. last visited) (read  |
3399   |                     | only)                                            |
3400   |---------------------+--------------------------------------------------|
3401   | $autocolor-hook     | name of the hook that runs when autocolor is     |
3402   |                     | enabled                                          |
3403   |---------------------+--------------------------------------------------|
3404   | $bchars             | number of characters in current buffer (read     |
3405   |                     | only)                                            |
3406   |---------------------+--------------------------------------------------|
3407   | $bchanged           | true if current buffer is modified (boolean)     |
3408   |---------------------+--------------------------------------------------|
3409   |                     | status flags for current buffer (read only)      |
3410   |                     |                                                  |
3411   |                     | +----------------------------------------------+ |
3412   |                     | | Flag | Description                           | |
3413   |                     | |------+---------------------------------------| |
3414   |                     | | a    | autobuffer caused this to be created  | |
3415   |                     | |------+---------------------------------------| |
3416   |                     | | d    | directory listing                     | |
3417   | $bflags             | |------+---------------------------------------| |
3418   |                     | | i    | invisible, e.g., tags                 | |
3419   |                     | |------+---------------------------------------| |
3420   |                     | | m    | modified                              | |
3421   |                     | |------+---------------------------------------| |
3422   |                     | | s    | scratch, will be removed when popped  | |
3423   |                     | |      | down                                  | |
3424   |                     | |------+---------------------------------------| |
3425   |                     | | u    | unread                                | |
3426   |                     | +----------------------------------------------+ |
3427   |---------------------+--------------------------------------------------|
3428   | $blines             | number of lines in current buffer (read only)    |
3429   |---------------------+--------------------------------------------------|
3430   | $brightness         | RGB levels for gray, normal, bright in the 0-255 |
3431   |                     | range (winvile version only)                     |
3432   |---------------------+--------------------------------------------------|
3433   | $buf-fname-expr     | combined buffer+fname expression (read only)     |
3434   |---------------------+--------------------------------------------------|
3435   | $buffer-hook        | name of procedure to run when switching to a     |
3436   |                     | buffer                                           |
3437   |---------------------+--------------------------------------------------|
3438   | $bufname            | current buffer-name under the cursor.            |
3439   |---------------------+--------------------------------------------------|
3440   | $bwindows           | number of windows open on current buffer(read    |
3441   |                     | only)                                            |
3442   |---------------------+--------------------------------------------------|
3443   | $cbufname           | current buffer name                              |
3444   |---------------------+--------------------------------------------------|
3445   | $cdpath             | editor's copy of the $CDPATH env var             |
3446   |                     | (read/write)                                     |
3447   |---------------------+--------------------------------------------------|
3448   | $cd-hook            | name of procedure to run when changing           |
3449   |                     | directories                                      |
3450   |---------------------+--------------------------------------------------|
3451   |                     | comma-delimited list of "interesting" compiled   |
3452   |                     | options (read only).                             |
3453   |                     |                                                  |
3454   |                     | +----------------------------------------------+ |
3455   |                     | | Name      | Description                      | |
3456   |                     | |-----------+----------------------------------| |
3457   |                     | | ansi      | vile built with ANSI terminal    | |
3458   |                     | |           | driver                           | |
3459   |                     | |-----------+----------------------------------| |
3460   |                     | | athena    | xvile built with Athena widgets  | |
3461   |                     | |-----------+----------------------------------| |
3462   |                     | | borland   | vile built with Borland/DJGPP    | |
3463   |                     | |           | driver                           | |
3464   |                     | |-----------+----------------------------------| |
3465   |                     | | curses    | editor uses curses terminal      | |
3466   |                     | |           | driver                           | |
3467   |                     | |-----------+----------------------------------| |
3468   |                     | | hypertext | editor supports highlighting and | |
3469   |                     | |           | links                            | |
3470   |                     | |-----------+----------------------------------| |
3471   |                     | | iconv     | editor has iconv locale support  | |
3472   |                     | |-----------+----------------------------------| |
3473   |                     | | locale    | editor uses system's LC_CTYPE    | |
3474   |                     | |           | locale                           | |
3475   |                     | |-----------+----------------------------------| |
3476   |                     | | motif     | xvile built with Motif libraries | |
3477   |                     | |-----------+----------------------------------| |
3478   |                     | | multibyte | vile built with multibyte        | |
3479   |                     | |           | locales                          | |
3480   |                     | |-----------+----------------------------------| |
3481   |                     | | nextaw    | xvile built with Athena widgets  | |
3482   |                     | |           | (NeXtaw)                         | |
3483   |                     | |-----------+----------------------------------| |
3484   |                     | | ntcons    | vile built for Win32 console     | |
3485   |                     | |-----------+----------------------------------| |
3486   | $cfgopts            | | ntwin     | vile built for Win32 GUI         | |
3487   |                     | |-----------+----------------------------------| |
3488   |                     | | noshell   | shell commands are disabled      | |
3489   |                     | |-----------+----------------------------------| |
3490   |                     | | oleauto   | editor supports OLE automation.  | |
3491   |                     | |-----------+----------------------------------| |
3492   |                     | | openlook  | xvile built with OpenLook        | |
3493   |                     | |           | libraries                        | |
3494   |                     | |-----------+----------------------------------| |
3495   |                     | | os2vio    | vile built for OS/2 VIO console  | |
3496   |                     | |-----------+----------------------------------| |
3497   |                     | | perl      | editor includes perl interpreter | |
3498   |                     | |-----------+----------------------------------| |
3499   |                     | | termcap   | editor reads TERMCAP db for      | |
3500   |                     | |           | screen info.                     | |
3501   |                     | |-----------+----------------------------------| |
3502   |                     | | terminfo  | editor reads TERMINFO db for     | |
3503   |                     | |           | screen info.                     | |
3504   |                     | |-----------+----------------------------------| |
3505   |                     | | vmsvt     | vile built for VMS terminal      | |
3506   |                     | |-----------+----------------------------------| |
3507   |                     | | xaw       | xvile built with Athena widgets  | |
3508   |                     | |           | (Xaw)                            | |
3509   |                     | |-----------+----------------------------------| |
3510   |                     | | xaw3d     | xvile built with Athena widgets  | |
3511   |                     | |           | (Xaw3d)                          | |
3512   |                     | |-----------+----------------------------------| |
3513   |                     | | xaw3dxft  | xvile built with Athena widgets  | |
3514   |                     | |           | (Xaw3dxft)                       | |
3515   |                     | |-----------+----------------------------------| |
3516   |                     | | xawplus   | xvile built with Athena widgets  | |
3517   |                     | |           | (XawPlus)                        | |
3518   |                     | |-----------+----------------------------------| |
3519   |                     | | xft       | xvile built with TrueType font   | |
3520   |                     | |           | support (Xft)                    | |
3521   |                     | +----------------------------------------------+ |
3522   |---------------------+--------------------------------------------------|
3523   | $cfilname           | current file name                                |
3524   |---------------------+--------------------------------------------------|
3525   | $char               | character under the cursor                       |
3526   |---------------------+--------------------------------------------------|
3527   | $cmd-count          | repeat-counter for the current macro (read only) |
3528   |---------------------+--------------------------------------------------|
3529   | $cmd-encoding       | character set to use for minibuffer              |
3530   |---------------------+--------------------------------------------------|
3531   | $cmd-motion         | motion for the current operator (read only)      |
3532   |---------------------+--------------------------------------------------|
3533   | $cryptkey           | encryption key (write only)                      |
3534   |---------------------+--------------------------------------------------|
3535   | $curchar            | character offset in file                         |
3536   |---------------------+--------------------------------------------------|
3537   | $curcol             | current column position of cursor                |
3538   |---------------------+--------------------------------------------------|
3539   | $curline            | current line in file                             |
3540   |---------------------+--------------------------------------------------|
3541   | $cwd                | current directory                                |
3542   |---------------------+--------------------------------------------------|
3543   | $cwline             | line offset in current window                    |
3544   |---------------------+--------------------------------------------------|
3545   | $debug              | macro debugging - set true for line by line      |
3546   |                     | tracing                                          |
3547   |---------------------+--------------------------------------------------|
3548   | $directory          | controls location of temp-files (unused)         |
3549   |---------------------+--------------------------------------------------|
3550   | $discmd             | display commands on command line (boolean)       |
3551   |---------------------+--------------------------------------------------|
3552   | $disinp             | display command line input characters (boolean)  |
3553   |---------------------+--------------------------------------------------|
3554   | $empty-lines        | parameter for force-empty-lines command          |
3555   |---------------------+--------------------------------------------------|
3556   | $encoding           | character set associated with locale (read only) |
3557   |---------------------+--------------------------------------------------|
3558   | $end-of-cmd         | true if user ended the cmd with <cr>             |
3559   |---------------------+--------------------------------------------------|
3560   | $error-buffer       | buffer name assigned to the error-buffer         |
3561   |---------------------+--------------------------------------------------|
3562   | $error-expr         | regular expression that matched the error-buffer |
3563   |---------------------+--------------------------------------------------|
3564   | $error-match        | text that matched the error-buffer               |
3565   |---------------------+--------------------------------------------------|
3566   | $error-tabstop      | tabstop to use with error-buffer for %C          |
3567   |---------------------+--------------------------------------------------|
3568   | $exec-path          | where to find vile (read only)                   |
3569   |---------------------+--------------------------------------------------|
3570   | $exec-suffix        | suffix, if any, for execable programs (read      |
3571   |                     | only)                                            |
3572   |---------------------+--------------------------------------------------|
3573   | $exit-hook          | name of procedure to run when quitting           |
3574   |---------------------+--------------------------------------------------|
3575   | $favorites          | path to favorites folder (win32 only) (read      |
3576   |                     | only)                                            |
3577   |---------------------+--------------------------------------------------|
3578   | $fchanged           | true if file for current buffer is modified      |
3579   |                     | (boolean)                                        |
3580   |---------------------+--------------------------------------------------|
3581   | $fence-limit        | iteration limit for complex fences               |
3582   |---------------------+--------------------------------------------------|
3583   | $filename-expr      | actual pattern for %F in [Error Expressions]     |
3584   |---------------------+--------------------------------------------------|
3585   | $filter-list        | list of builtin-filters (read only)              |
3586   |---------------------+--------------------------------------------------|
3587   | $findpath           | editor's copy of the $VILE_FINDPATH env var      |
3588   |                     | (read/write)                                     |
3589   |---------------------+--------------------------------------------------|
3590   | $find-cmd           | last spawned find command (read only)            |
3591   |---------------------+--------------------------------------------------|
3592   | $font               | current font name (X11/winvile versions only)    |
3593   |---------------------+--------------------------------------------------|
3594   | $forward-search     | search direction, true=forward                   |
3595   |---------------------+--------------------------------------------------|
3596   | $get-at-dot         | ensure that "identifier-like" matching includes  |
3597   |                     | current editing position.                        |
3598   |---------------------+--------------------------------------------------|
3599   | $get-it-all         | match entire "identifier-like" word under the    |
3600   |                     | cursor.                                          |
3601   |---------------------+--------------------------------------------------|
3602   | $get-length         | sets length of "identifier-like" word as         |
3603   |                     | side-effect.                                     |
3604   |---------------------+--------------------------------------------------|
3605   | $get-offset         | sets offset of "identifier-like" word as         |
3606   |                     | side-effect.                                     |
3607   |---------------------+--------------------------------------------------|
3608   | $helpfile           | $VILE_HELP_FILE env var or "vile.hlp"            |
3609   |                     | (read/write)                                     |
3610   |---------------------+--------------------------------------------------|
3611   | $iconname           | current icon name (X11 version only)             |
3612   |---------------------+--------------------------------------------------|
3613   | $identifier         | current "identifier-like" word under the cursor. |
3614   |---------------------+--------------------------------------------------|
3615   | $kbd-encoding       | keyboard encoding                                |
3616   |---------------------+--------------------------------------------------|
3617   | $kbd-macro          | the keyboard macro, see ^X-( ^X-) (read only)    |
3618   |---------------------+--------------------------------------------------|
3619   | $kill               | some of the kill register (read only)            |
3620   |---------------------+--------------------------------------------------|
3621   | $kill-limit         | maximum length for $kill                         |
3622   |---------------------+--------------------------------------------------|
3623   | $kill-size          | length of the kill register (read only)          |
3624   |---------------------+--------------------------------------------------|
3625   | $lastkey            | last keyboard char struck                        |
3626   |---------------------+--------------------------------------------------|
3627   | $latin1-expr        | pattern to match locales using ISO-8859-1 in     |
3628   |                     | case they are not installed                      |
3629   |---------------------+--------------------------------------------------|
3630   | $lcols              | length of current line, in columns (read only)   |
3631   |---------------------+--------------------------------------------------|
3632   | $libdir-path        | appended to $PATH when running filters           |
3633   |---------------------+--------------------------------------------------|
3634   | $line               | text of current line starting with cursor        |
3635   |---------------------+--------------------------------------------------|
3636   | $llength            | length of current line (read only)               |
3637   |---------------------+--------------------------------------------------|
3638   | $locale             | locale, which determines character type (read    |
3639   |                     | only)                                            |
3640   |---------------------+--------------------------------------------------|
3641   | $majormode          | current majormode, if any (read only)            |
3642   |---------------------+--------------------------------------------------|
3643   | $majormode-hook     | procedure to override suffix/preamble rules      |
3644   |---------------------+--------------------------------------------------|
3645   | $match              | last matched magic pattern (read only)           |
3646   |---------------------+--------------------------------------------------|
3647   | $menu-file          | the name of the menu file (e.g. .vilemenu)       |
3648   |---------------------+--------------------------------------------------|
3649   | $mode               | current mode ("command","insert","overwrite")    |
3650   |                     | (rd. o.)                                         |
3651   |---------------------+--------------------------------------------------|
3652   | $modeline-format    | format of mode lines. see "Mode line             |
3653   |                     | customization".                                  |
3654   |---------------------+--------------------------------------------------|
3655   | $modeline-limit     | maximum inline offset to scan for mode lines     |
3656   |---------------------+--------------------------------------------------|
3657   | $modified           | is current buffer modified or not? (read only)   |
3658   |---------------------+--------------------------------------------------|
3659   | $ncolors            | number of displayed colors, must be power of two |
3660   |---------------------+--------------------------------------------------|
3661   | $ntildes            | percent of window filled by ~ chars, at end of   |
3662   |                     | buffer                                           |
3663   |---------------------+--------------------------------------------------|
3664   | $ocwd               | previous directory (read only)                   |
3665   |---------------------+--------------------------------------------------|
3666   |                     | "dos", "vms", "os/2", "win32", and "unix",       |
3667   | $os                 | although the latter may be replaced with a more  |
3668   |                     | specific name derived from vile's configure      |
3669   |                     | script. (read only)                              |
3670   |---------------------+--------------------------------------------------|
3671   | $pagelen            | number of screen lines in use by editor          |
3672   |---------------------+--------------------------------------------------|
3673   | $pagewid            | current screen width                             |
3674   |---------------------+--------------------------------------------------|
3675   | $palette            | current palette string                           |
3676   |---------------------+--------------------------------------------------|
3677   | $patchlevel         | current patch-level (empty for release) (read    |
3678   |                     | only)                                            |
3679   |---------------------+--------------------------------------------------|
3680   | $pathlist-separator | separator for lists of pathnames, e.g., $PATH    |
3681   |---------------------+--------------------------------------------------|
3682   | $pathname           | current "path-like" word, under the cursor.      |
3683   |---------------------+--------------------------------------------------|
3684   | $pathname-separator | separator for levels of pathnames, e.g., '/'     |
3685   |---------------------+--------------------------------------------------|
3686   | $pending            | typeahead pending flag (read only)               |
3687   |---------------------+--------------------------------------------------|
3688   | $pid                | returns vile's process-id (read only)            |
3689   |---------------------+--------------------------------------------------|
3690   | $position-format    | format of ^G command. see "Mode line             |
3691   |                     | customization".                                  |
3692   |---------------------+--------------------------------------------------|
3693   | $progname           | returns "vile" or "xvile" or "winvile". (read    |
3694   |                     | only)                                            |
3695   |---------------------+--------------------------------------------------|
3696   | $prompt             | the command-line prompt string ": "              |
3697   |---------------------+--------------------------------------------------|
3698   | $qidentifier        | current qualified name (as with C++ ::)          |
3699   |---------------------+--------------------------------------------------|
3700   | $read-hook          | name of procedure to run after a file is read    |
3701   |---------------------+--------------------------------------------------|
3702   | $replace            | replacement pattern                              |
3703   |---------------------+--------------------------------------------------|
3704   | $return             | set within a macro to provide $_ on completion   |
3705   |---------------------+--------------------------------------------------|
3706   | $search             | search pattern                                   |
3707   |---------------------+--------------------------------------------------|
3708   | $seed               | current random number seed                       |
3709   |---------------------+--------------------------------------------------|
3710   | $shell              | name of the shell program for spawned commands.  |
3711   |---------------------+--------------------------------------------------|
3712   | $sres               | current screen resolution                        |
3713   |---------------------+--------------------------------------------------|
3714   |                     | the name of the startup file (e.g. .vilerc).     |
3715   | $startup-file       | Normally this is only a filename, but can be an  |
3716   |                     | absolute path to override $startup-path.         |
3717   |---------------------+--------------------------------------------------|
3718   |                     | where to find the startup file, i.e., a          |
3719   | $startup-path       | colon-separated list of directories on Unix-like |
3720   |                     | systems. On Windows, use semicolon for           |
3721   |                     | separating the items in the list.                |
3722   |---------------------+--------------------------------------------------|
3723   | $status             | returns the status of the last command           |
3724   |---------------------+--------------------------------------------------|
3725   | $system-crlf        | the default value for dos mode, which can be     |
3726   |                     | preset using -u or -U options                    |
3727   |---------------------+--------------------------------------------------|
3728   | $system-name        | returns the operating system name shown in the   |
3729   |                     | version command                                  |
3730   |---------------------+--------------------------------------------------|
3731   | $term-cols          | number of columns in terminal window (read only) |
3732   |---------------------+--------------------------------------------------|
3733   | $term-encoding      | terminal's encoding support (read only)          |
3734   |---------------------+--------------------------------------------------|
3735   | $term-lines         | number of lines in terminal window (read only)   |
3736   |---------------------+--------------------------------------------------|
3737   | $term-resizes       | true if vile handles terminal-resizing (read     |
3738   |                     | only)                                            |
3739   |---------------------+--------------------------------------------------|
3740   | $title              | current window title (X11, win32 versions only)  |
3741   |---------------------+--------------------------------------------------|
3742   | $title-encoding     | encoding of xterm window title, e.g., "8bit" for |
3743   |                     | ISO-8859-1 or "utf-8".                           |
3744   |---------------------+--------------------------------------------------|
3745   | $title-format       | format of window title. see "Mode line           |
3746   |                     | customization".                                  |
3747   |---------------------+--------------------------------------------------|
3748   | $version            | current version number (read only)               |
3749   |---------------------+--------------------------------------------------|
3750   | $with-prefix        | string set by "~with" directives (read only)     |
3751   |---------------------+--------------------------------------------------|
3752   | $wlines             | number of lines in current window                |
3753   |---------------------+--------------------------------------------------|
3754   | $word               | current "word", a sequence of nonblanks          |
3755   |---------------------+--------------------------------------------------|
3756   | $write-hook         | name of procedure to run before a file is        |
3757   |                     | written                                          |
3758   |---------------------+--------------------------------------------------|
3759   | $xdisplay           | the value to set $DISPLAY when running $xshell.  |
3760   |---------------------+--------------------------------------------------|
3761   | $xshell             | name of the terminal program for spawned xvile   |
3762   |                     | commands.                                        |
3763   |---------------------+--------------------------------------------------|
3764   | $xshell-flags       | command-line flags after $xshell, normally "-e"  |
3765   +------------------------------------------------------------------------+
3766
3767   In addition to the state variables, you may set and use the values of the
3768   editor modes (i.e., universal modes, buffer-only modes or window-only
3769   modes), e.g., "setv $dos=true". The global values of the editor modes are
3770   not visible to the expression evaluator.
3771
3772   User-defined variables can also be set and used; their names are prefixed
3773   with the '%' character.
3774
3775   Response variables (a '@' followed by a prompt-string) cause vile to
3776   prompt for input with the given prompt-string.
3777
3778   Buffer variables (a '<' followed by a buffer name) return the current line
3779   of the specified buffer, automatically setting the position to the next
3780   line.
3781
3782  Functions
3783
3784   There are also functions available, which can act on those variables, or
3785   on hard-coded values. Operations are expressed in prefix notation, so to
3786   add to numbers you would say "&add 3 5". You may use any unique
3787   abbreviation of the function names.
3788
3789   The "describe-user-functions" command shows this information:
3790
3791   +------------------------------------------------------------------------+
3792   | Name            | Args | Description                                   |
3793   |-----------------+------+-----------------------------------------------|
3794   | &abs            | 1    | absolute value of a number                    |
3795   |-----------------+------+-----------------------------------------------|
3796   | &add            | 2    | add two numbers together                      |
3797   |-----------------+------+-----------------------------------------------|
3798   | &and            | 2    | logical and                                   |
3799   |-----------------+------+-----------------------------------------------|
3800   | &ascii          | 1    | char to integer conversion                    |
3801   |-----------------+------+-----------------------------------------------|
3802   | &bchanged       | 1    | true if given buffer is modified              |
3803   |-----------------+------+-----------------------------------------------|
3804   | &bind           | 1    | lookup what function name is bound to key     |
3805   |-----------------+------+-----------------------------------------------|
3806   | &cat            | 2    | concatenate string                            |
3807   |-----------------+------+-----------------------------------------------|
3808   | &cclass         | 1    | character class (see "show-printable")        |
3809   |-----------------+------+-----------------------------------------------|
3810   | &chr            | 1    | integer to char conversion                    |
3811   |-----------------+------+-----------------------------------------------|
3812   | &classof        | 1    | inverse of &isa, returns classes for param    |
3813   |-----------------+------+-----------------------------------------------|
3814   | &cmatch         | 2    | caseless match regular-expression value       |
3815   |-----------------+------+-----------------------------------------------|
3816   | &date           | 2    | format 2nd param with 1st, like strftime.     |
3817   |-----------------+------+-----------------------------------------------|
3818   | &default        | 1    | initial/default value for mode or state       |
3819   |                 |      | variable                                      |
3820   |-----------------+------+-----------------------------------------------|
3821   | &divide         | 2    | division                                      |
3822   |-----------------+------+-----------------------------------------------|
3823   | &dquery         | 2    | prompt user for input, given default value    |
3824   |-----------------+------+-----------------------------------------------|
3825   | &env            | 1    | retrieve a system environment variable        |
3826   |-----------------+------+-----------------------------------------------|
3827   | &equal          | 2    | numeric equality                              |
3828   |-----------------+------+-----------------------------------------------|
3829   | &error          | 1    | true if the parameter was ERROR               |
3830   |-----------------+------+-----------------------------------------------|
3831   | &execable       | 1    | true if file is exec'able                     |
3832   |-----------------+------+-----------------------------------------------|
3833   | &fchanged       | 1    | true if file for given buffer is modified     |
3834   |-----------------+------+-----------------------------------------------|
3835   | &filter         | 1    | true if the given majormode's filter is       |
3836   |                 |      | builtin                                       |
3837   |-----------------+------+-----------------------------------------------|
3838   | &ftime          | 1    | modification-time of the given file, as a     |
3839   |                 |      | number                                        |
3840   |-----------------+------+-----------------------------------------------|
3841   | &geq            | 2    | numeric greater than or equal                 |
3842   |-----------------+------+-----------------------------------------------|
3843   | &get-key        | 0    | (alias for &gtkey)                            |
3844   |-----------------+------+-----------------------------------------------|
3845   | &get-key        | 0    | (alias for &gtkey)                            |
3846   |-----------------+------+-----------------------------------------------|
3847   | &get-completion | 2    | get name-completion for given category and    |
3848   |                 |      | value (see below for arguments)               |
3849   |-----------------+------+-----------------------------------------------|
3850   | &get-motion     | 1    | (alias for &gtmotion)                         |
3851   |-----------------+------+-----------------------------------------------|
3852   | &get-sequence   | 0    | (alias for &gtsequence)                       |
3853   |-----------------+------+-----------------------------------------------|
3854   | &global         | 1    | retrieves global mode setting                 |
3855   |-----------------+------+-----------------------------------------------|
3856   | &greater        | 2    | numeric greater than                          |
3857   |-----------------+------+-----------------------------------------------|
3858   | &gt             | 2    | numeric greater than                          |
3859   |-----------------+------+-----------------------------------------------|
3860   | &gtkey          | 0    | get 1 character                               |
3861   |-----------------+------+-----------------------------------------------|
3862   | &gtmotion       | 1    | get keycode motion sequence for the binding   |
3863   |-----------------+------+-----------------------------------------------|
3864   | &gtsequence     | 0    | get keycode sequence, e.g., #1                |
3865   |-----------------+------+-----------------------------------------------|
3866   | &indirect       | 1    | evaluate indirect value                       |
3867   |-----------------+------+-----------------------------------------------|
3868   | &isa            | 2    | check if the second param is a member of      |
3869   |                 |      | first                                         |
3870   |-----------------+------+-----------------------------------------------|
3871   | &left           | 2    | left string(string, len)                      |
3872   |-----------------+------+-----------------------------------------------|
3873   | &length         | 1    | string length                                 |
3874   |-----------------+------+-----------------------------------------------|
3875   | &leq            | 2    | numeric less than or equal                    |
3876   |-----------------+------+-----------------------------------------------|
3877   | &lessthan       | 2    | numeric less than                             |
3878   |-----------------+------+-----------------------------------------------|
3879   | &local          | 1    | retrieves local mode setting                  |
3880   |-----------------+------+-----------------------------------------------|
3881   | &lookup         | 2    | look for filename (see below for arguments)   |
3882   |-----------------+------+-----------------------------------------------|
3883   | &lower          | 1    | lower case string                             |
3884   |-----------------+------+-----------------------------------------------|
3885   | &lt             | 2    | numeric less than                             |
3886   |-----------------+------+-----------------------------------------------|
3887   | &match          | 2    | match regular-expression value                |
3888   |-----------------+------+-----------------------------------------------|
3889   | &mclass         | 1    | returns the mode's class, e.g., buffer or     |
3890   |                 |      | Major                                         |
3891   |-----------------+------+-----------------------------------------------|
3892   | &middle         | 3    | mid string(string, pos, len)                  |
3893   |-----------------+------+-----------------------------------------------|
3894   | &modulo         | 2    | modulus                                       |
3895   |-----------------+------+-----------------------------------------------|
3896   | &negate         | 1    | negate                                        |
3897   |-----------------+------+-----------------------------------------------|
3898   | &neq            | 2    | numeric inequality                            |
3899   |-----------------+------+-----------------------------------------------|
3900   | &not            | 1    | logical not                                   |
3901   |-----------------+------+-----------------------------------------------|
3902   | &or             | 2    | logical or                                    |
3903   |-----------------+------+-----------------------------------------------|
3904   | &path           | 2    | extract/translate pathname (see below for     |
3905   |                 |      | args)                                         |
3906   |-----------------+------+-----------------------------------------------|
3907   | &pcat           | 2    | concatenate directory and filename            |
3908   |-----------------+------+-----------------------------------------------|
3909   | &pquote         | 1    | quote pathname if needed, e.g., embedded      |
3910   |                 |      | spaces                                        |
3911   |-----------------+------+-----------------------------------------------|
3912   | &qpasswd        | 1    | prompt user for password string               |
3913   |-----------------+------+-----------------------------------------------|
3914   | &query          | 1    | prompt user for input                         |
3915   |-----------------+------+-----------------------------------------------|
3916   | &random         | 1    | get a random number from 1 to n               |
3917   |-----------------+------+-----------------------------------------------|
3918   | &rd             | 1    | is a file readable                            |
3919   |-----------------+------+-----------------------------------------------|
3920   | &readable       | 1    | is a file readable                            |
3921   |-----------------+------+-----------------------------------------------|
3922   | &regex-escape   | 1    | returns value with regex metacharacters       |
3923   |                 |      | escaped                                       |
3924   |-----------------+------+-----------------------------------------------|
3925   | &register       | 1    | value of register (1-character name)          |
3926   |-----------------+------+-----------------------------------------------|
3927   | &right          | 2    | right string(string, pos)                     |
3928   |-----------------+------+-----------------------------------------------|
3929   | &rnd            | 1    | get a random number from 1 to n               |
3930   |-----------------+------+-----------------------------------------------|
3931   | &sequal         | 2    | string logical equality check                 |
3932   |-----------------+------+-----------------------------------------------|
3933   | &sgeq           | 2    | string greater than or equal                  |
3934   |-----------------+------+-----------------------------------------------|
3935   | &sgreater       | 2    | string logical greater than                   |
3936   |-----------------+------+-----------------------------------------------|
3937   | &sgt            | 2    | string greater than                           |
3938   |-----------------+------+-----------------------------------------------|
3939   | &sindex         | 2    | find the index of second string in first      |
3940   |-----------------+------+-----------------------------------------------|
3941   | &sleq           | 2    | string less than or equal                     |
3942   |-----------------+------+-----------------------------------------------|
3943   | &sless          | 2    | string logical less than                      |
3944   |-----------------+------+-----------------------------------------------|
3945   | &slt            | 2    | string less than                              |
3946   |-----------------+------+-----------------------------------------------|
3947   | &sneq           | 2    | string inequality                             |
3948   |-----------------+------+-----------------------------------------------|
3949   | &stime          | 1    | system-time, as a number                      |
3950   |-----------------+------+-----------------------------------------------|
3951   | &stoken         | 3    | true if token found in string, given delims   |
3952   |-----------------+------+-----------------------------------------------|
3953   | &subtract       | 2    | subtraction                                   |
3954   |-----------------+------+-----------------------------------------------|
3955   | &times          | 2    | multiplication                                |
3956   |-----------------+------+-----------------------------------------------|
3957   | &token          | 3    | select n'th token of string, given delims     |
3958   |-----------------+------+-----------------------------------------------|
3959   | &translate      | 3    | translate "from" to "to" for given string.    |
3960   |-----------------+------+-----------------------------------------------|
3961   | &trim           | 1    | trim whitespace from string                   |
3962   |-----------------+------+-----------------------------------------------|
3963   | &upper          | 1    | uppercase string                              |
3964   |-----------------+------+-----------------------------------------------|
3965   | &word           | 2    | select n'th word of string, blank-separated   |
3966   |-----------------+------+-----------------------------------------------|
3967   | &writable       | 1    | is a file writable                            |
3968   +------------------------------------------------------------------------+
3969
3970   The &get-completion function takes two arguments. The first is a category
3971   (one of "buffer", "command", "directory", "filename", "register" or
3972   "tags"). The second is an initial value to complete.
3973
3974   The &lookup function takes two arguments. The first is a keyword and the
3975   second is a filename. Keywords may be combined with '+', e.g., r+bin to
3976   find a readable file in the directory where vile's executable is. The
3977   keywords are for location:
3978
3979   +------------------------------------------------------------------------+
3980   | bin      | look in vile's directory                                    |
3981   |----------+-------------------------------------------------------------|
3982   | current  | look in the current directory                               |
3983   |----------+-------------------------------------------------------------|
3984   | home     | look in user's $HOME directory                              |
3985   |----------+-------------------------------------------------------------|
3986   | insecure | permit matches on files with insecure permissions (see      |
3987   |          | check-access).                                              |
3988   |----------+-------------------------------------------------------------|
3989   | libdir   | look along $libdir-path                                     |
3990   |----------+-------------------------------------------------------------|
3991   | path     | look along user's $PATH                                     |
3992   |----------+-------------------------------------------------------------|
3993   | startup  | look along $startup-path                                    |
3994   +------------------------------------------------------------------------+
3995
3996   and for access type, defaulting to an existence check:
3997
3998   +--------------------------------------+
3999   | execable | test if file is exec'able |
4000   |----------+---------------------------|
4001   | readable | test if file is readable  |
4002   |----------+---------------------------|
4003   | writable | test if file is writable  |
4004   +--------------------------------------+
4005
4006   Search order is fixed: current, home, bin, startup, path, libdir
4007
4008   The &path function takes two arguments. The first is a keyword and the
4009   second is a pathname. Keywords are: end (suffix of the filename), full
4010   (absolute path), head (directory), root (filename without suffix), short
4011   (relative path), tail (filename).
4012
4013  Directives
4014
4015   Primitive flow-of-control within a macro may be obtained with certain
4016   directives. Macro directives start with a "~" and include the following:
4017   (see the file macros.doc for more detail)
4018
4019   +------------------------------------------------------------------------+
4020   | Name             | Description                                        ||
4021   |------------------+----------------------------------------------------+|
4022   | ~break           | exit a ~while loop                                 ||
4023   |------------------+----------------------------------------------------+|
4024   | ~else            | default conditional execution                      ||
4025   |------------------+----------------------------------------------------||
4026   | ~elseif cond     | alternate conditional execution                    ||
4027   |------------------+----------------------------------------------------||
4028   | ~elsewith tokens | alterate tokens to following commands              ||
4029   |------------------+----------------------------------------------------||
4030   | ~endif           | finish conditional execution                       ||
4031   |------------------+----------------------------------------------------+|
4032   | ~endm            | finish a macro                                     ||
4033   |------------------+----------------------------------------------------+|
4034   | ~endwhile        | finish a ~while loop                               ||
4035   |------------------+----------------------------------------------------+|
4036   | ~endwith         | finish a ~with block                               ||
4037   |------------------+----------------------------------------------------+|
4038   | ~force           | force macro to continue even if command fails      ||
4039   |------------------+----------------------------------------------------||
4040   | ~goto label      | jump to a label in the current macro               ||
4041   |------------------+----------------------------------------------------+|
4042   | ~hidden          | do not update screen while the macro executes      ||
4043   |------------------+----------------------------------------------------+|
4044   | ~if cond         | start conditional execution                        ||
4045   |------------------+----------------------------------------------------||
4046   | ~local vars      | save specified variables, restore when macro       ||
4047   |                  | terminates                                         ||
4048   |------------------+----------------------------------------------------+|
4049   | ~quiet           | suppress messages while the macro executes         ||
4050   |------------------+----------------------------------------------------+|
4051   | ~return          | terminate current macro                            ||
4052   |------------------+----------------------------------------------------||
4053   | ~trace cond      | set $debug trace                                   ||
4054   |------------------+----------------------------------------------------||
4055   | ~while cond      | execute a loop if the condition is true            ||
4056   |------------------+----------------------------------------------------||
4057   | ~with tokens     | prepend tokens to following commands               ||
4058   +------------------------------------------------------------------------+
4059
4060   Line labels begin with a "*" as the first nonblank char, like:
4061
4062     *LBL01
4063
4064   You would jump to this with:
4065
4066     ~goto LBL01
4067
4068   Lines ending with '\' are joined before interpreting them.
4069
4070  Hooks
4071
4072   There are a few places within vile where a user-specifiable procedure will
4073   be executed if desired. These points are referred to as "hooks". Hooks are
4074   specified by special variables which hold the name of a procedure to run
4075   at that point in the code. For instance, there is a "cd-hook", which is
4076   run when you changej directories. Assume the following are included within
4077   a vile startup file:
4078
4079     store-procedure my-cd-action
4080            write-message &cat &cat &cat "moved from " $ocwd " to " $cwd
4081            ~if &seq $progname "xvile"
4082                    set-variable $title $cwd
4083            ~endif
4084     ~endm
4085     set cd-hook my-cd-action
4086
4087   Whenever the current directory is changed within the editor (via the "cd"
4088   command), my-cd-action will print a message and, under xvile, change the
4089   window title.
4090
4091   The following hooks are currently implemented:
4092
4093   +------------------------------------------------------------------------+
4094   | $autocolor-hook | applies syntax coloring to modified buffers when the |
4095   |                 | keyboard is idle for a user-configurable time period |
4096   |-----------------+------------------------------------------------------|
4097   | $buffer-hook    | run when switching to a buffer                       |
4098   |-----------------+------------------------------------------------------|
4099   | $cd-hook        | run when changing directories                        |
4100   |-----------------+------------------------------------------------------|
4101   | $exit-hook      | run when quitting                                    |
4102   |-----------------+------------------------------------------------------|
4103   | $majormode-hook | procedure to override suffix/preamble rules          |
4104   |-----------------+------------------------------------------------------|
4105   | $read-hook      | run after a file is read                             |
4106   |-----------------+------------------------------------------------------|
4107   | $write-hook     | run before a file is written                         |
4108   +------------------------------------------------------------------------+
4109
4110   Be careful with "buffer-hook". Executing commands in the hook which
4111   themselves switch buffers is not recommended. In general, all the hooks
4112   are a little dangerous, since vile has not been written with re-entrancy
4113   foremost in mind. One should avoid putting actions in hooks which might
4114   cause the hook to be re-executed. (vile keeps the hook procedure itself
4115   from being re-executed, to prevent recursion, but the code surrounding the
4116   call to it may not be safe either.)
4117
4118  Macro examples
4119
4120   To prevent vile from thinking that a failed command is an error in the
4121   macro, you can put "~force" in front of it. So, to write a macro which
4122   will run the "man" command on the identifier under the cursor, where you
4123   don't really consider it an error if the command fails, you might use:
4124
4125     9 store-macro
4126             ~force 1 shell-command &cat "man " $identifier
4127     ~endm
4128     bind-key execute-macro-9 ^X-m
4129
4130   (The argument '1' suppresses the "press return" prompt which normally
4131   appears after a command runs, since man runs a pager which does this
4132   anyway.)
4133
4134   The "screen-search-forward" command could be re-implemented as:
4135
4136     10 store-macro
4137             ~force search-forward $identifier
4138     ~endm
4139     bind-key execute-macro-10 ^X-/
4140
4141   And the "screen-search-pattern-grab" command, normally bound to ^A-/,
4142   could be implemented with:
4143
4144     11 store-macro
4145         set-variable $search $identifier
4146         write-message &cat "Search pattern is now " $search
4147     ~endm
4148     bind-key execute-macro-11 ^A-/
4149
4150   A variation, which will not find the identifier if it is a substring of
4151   another word, is:
4152
4153     12 store-macro
4154             ~force search-forward &cat "\\<" &cat $identifier "\\>"
4155     ~endm
4156
4157   This works by surrounding the string with the \< and \> regular expression
4158   metacharacters.
4159
4160   Here's another example, which finds C++ qualified identifiers, and uses
4161   them for a tag lookup:
4162
4163           ; Implement  ^A-^] for qualified-name tag lookup
4164     24 store-macro
4165             backward-character
4166             ~local $search
4167             search-forward "^[a-zA-Z_][a-zA-Z0-9_:]*"
4168             write-message &cat "Tag pattern is now " $match
4169             ~force find-tag $match
4170     ~endm
4171     bind-key execute-macro-24 ^A-^]
4172
4173   (The "backward-character" is needed because "search-forward" will always
4174   skip the cursor position when scanning, so as to always find the next
4175   occurrence. The directive ~local is used to avoid disturbing the search
4176   string.)
4177
4178   Note that for simple key-remappings, binding is often preferable to
4179   creating a macro. Some people prefer using lower-case 'g' to as an
4180   equivalent to 'G', to goto a specific line. If done as a macro, like this:
4181
4182     3 store-macro
4183             goto-line
4184     ~endm
4185     bind-key execute-macro-3 g
4186
4187   then both g and G go to the end of the file, but whereas 1000G goes to
4188   line 1000, 1000g goes to the end of the file 1000 times. It is easier (and
4189   more correct) to do:
4190
4191     bind-key goto-line g
4192
4193   A couple more examples of slightly more complex macros: They cause a jump
4194   to the next (or previous) line of the same (or lesser) indent, skipping
4195   over empty lines. (Thanks to MIURA Masahiro)
4196
4197     ; macro 1 - back to the line of same indent
4198     ;
4199     1 store-macro
4200             first-nonwhite
4201             set-variable %indlev $curcol
4202             ~force back-line-at-bol
4203             ~if &seq &trim $line ""
4204                     ~goto L1
4205             ~endif
4206             ~while &les %indlev $curcol
4207                     *L1
4208                     ~force back-line-at-bol
4209                     ~if &seq $status "FALSE"
4210                             ~return
4211                     ~endif
4212                     ~if &seq &trim $line ""
4213                             ~goto L1
4214                     ~endif
4215             ~endwhile
4216     ~endm
4217     bind-key execute-macro-1 ^X-[
4218
4219     ; macro 2 - forward to the line of same indent
4220     ;
4221     2 store-macro
4222             first-nonwhite
4223             set-variable %indlev $curcol
4224             ~force down-line-at-bol
4225             ~if &seq &trim $line ""
4226                     ~goto L2
4227             ~endif
4228             ~while &les %indlev $curcol
4229                     *L2
4230                     ~force down-line-at-bol
4231                     ~if &seq $status "FALSE"
4232                             ~return
4233                     ~endif
4234                     ~if &seq &trim $line ""
4235                             ~goto L2
4236                     ~endif
4237             ~endwhile
4238     ~endm
4239     bind-key execute-macro-2 ^X-]
4240
4241     ; Use "@d" to change cwd to the dir containing the current file
4242     ; (contributed by Richard Hussong).  Keep in mind that "^M" is an
4243     ; explicit CR and that ":cd -" reverts cwd to its previous value.
4244     store-procedure cdcur
4245             cd &path head $cfilname
4246     ~endm
4247     use-register d load-register ":cdcur^M"
4248
4249     ;; Underline current line with user-specified char.  Ex:
4250     ;;        blah blah blah blah   <-- curr line
4251     ;;        +++++++++++++++++++   <-- underline with +
4252     ;; from Daniel L. Ashbrook .
4253     store-procedure underline-currline
4254             write-message "enter underline char now..."
4255             set-variable %linechar &gtkey
4256             write-message ""
4257             ; don't underline trailing whitespace (trivial)
4258             trim-lines-til end-of-line
4259             ; don't underline leading whitespace (nontrivial)
4260             goto-bol
4261             setv %ldspace=&equ $char &ascii ' '
4262             setv %ldtab=&equ $char &ascii "\t"
4263             setv %ldwhite=&or %ldspace %ldtab
4264             ~if %ldwhite
4265             ~force substitute-til next-punctuated-word '^\b\b*' ''
4266             ~endif
4267             ; compute length sans lead/trail whitespace
4268             set-variable %linelength $llength
4269             ~if %ldwhite
4270                     ; put leading whitespace back
4271                     undo-change
4272                     ; it's not possible to disable the screen clutter of
4273                     ; visual-matches mode (following a substitution)
4274                     ; for all buffers from within a macro. so substitute
4275                     ; for an improbable char (which achieves desired effect)
4276                     ~force substitute-til next-punctuated-word &chr \xff &chr \xff
4277                     ~force clear-visual-matches
4278             ~endif
4279             unset-variable %ustring
4280             set-variable %i 0
4281             ; build underline string in memory and insert with a
4282             ; single operation (optimizes undo)
4283             ~while &less %i %linelength
4284                     set-variable %ustring &cat %ustring %linechar
4285                     set-variable %i &add %i 1
4286             ~endwhile
4287             ; force ustring to align with prev line
4288             ~local $autoindent
4289             setv $autoindent=true
4290             goto-eol
4291             append-string &chr 13  ; 13 -> CR
4292             insert-string %ustring
4293             ~force next-line
4294             goto-bol
4295     ~endm
4296     bind-key underline-currline #-
4297
4298     ; macro 14 - grep for the word under the cursor, and put the result
4299     ;       in a buffer named after that word.  set the error-buffer,
4300     ;       so that ^X-^X may be used to visit the lines found by grep.
4301     ;       (we have to set error-buffer explicitly, since we renamed
4302     ;       the buffer -- otherwise it tracks the last pipe read by vile)
4303     14 store-macro
4304             set-variable %grepfor $identifier
4305             edit-file &cat "!egrep -n " &cat %grepfor " *.[chs]"
4306             rename-buffer %grepfor
4307             error-buffer %grepfor
4308     ~endm
4309     bind-key execute-macro-14 ^A-g
4310
4311   As a hint, it is (almost?) never correct to write a ':' command when
4312   creating a programmed macro. For instance, if you find yourself writing
4313   something like:
4314
4315     &cat ":!chmod +w " $cfilname
4316     &cat ":e! " $cfilname
4317
4318   (in an attempt to make a buffer writable before editing it), then what you
4319   really want is:
4320
4321     shell-command &cat "chmod +w " $cfilname
4322     replace-with-file $cfilname
4323
4324   Furthermore, some things are just as easy if done with a "keystroke" macro
4325   rather than a programmed macro:
4326
4327     ; use this as '@w'
4328     use-register w load-register ":!chmod +w %^M:setl noview^M:w^M"
4329
4330   or
4331
4332     map ^A-w ":!chmod +w %^M:setl noview^M:w^M"
4333
4334   (Of course you need to replace the ^M's with real carriage-returns.)
4335
4336  Picture Mode
4337
4338   Another example of a fairly complex vile procedure can be found in the
4339   file "pictmode.rc". The code there implements a primitive means of drawing
4340   "ASCII art". To use it, first ":source pictmode.rc" and then "run pic".
4341   See the comments at the top of pictmode.rc for more information...
4342
4343
4344Regular Expressions
4345-------------------
4346   Searches use regular expressions, which, as in vi, may be magic by default
4347   or not.
4348
4349   vile introduces some new magic metacharacters.
4350
4351   The code that implements the expressions is based directly on Henry
4352   Spencer's regexp code. Quoting from the original man page:
4353
4354   [For ease of reference, the metacharacters are noted on the left margin.]
4355
4356     \|   A regular expression is zero or more branches, separated by `\|'.
4357          It matches anything that matches one of the branches.
4358          A branch is zero or more pieces, concatenated. It matches a match
4359          for the first, followed by a match for the second, etc.
4360          A piece is an atom possibly followed by `*', `\+', or `\?'. An atom
4361     *    followed by `*' matches a sequence of 0 or more matches of the
4362     +    atom. An atom followed by `\+' matches a sequence of 1 or more
4363     \?   matches of the atom. An atom followed by `\?' matches a match of
4364          the atom, or the null string. [i.e., `\?' matches 0 or 1
4365          occurrences]
4366          An atom is a regular expression in backslashed parentheses
4367   \( \)  (matching a match for the regular expression), a range (see below),
4368    . ^   (matching any single character), `^' (matching the null string at
4369     $    the beginning of the input string), `$' (matching the null string
4370     \c   at the end of the input string), a `\' followed by a single
4371     c    character (matching that character), or a single character with no
4372          other significance (matching that character).
4373   \< \>  In addition, vile atoms may be: \< and \>, which match the
4374          beginning and end of a "word".
4375          Vile recognizes the X/Open regular expression character classes
4376          (and additional character classes), as well as shorthand
4377          expressions for them. You can use the shorthand expressions in a
4378          range or as an atom. Each shorthand expression has a complement,
4379          e.g., \w and \W.
4380   \i \I  [:alnum:]
4381   \a \A  [:alpha:]
4382   \b \B  [:blank:]
4383   \c \C  [:cntrl:]
4384   \d \D  [:digit:]
4385   \f \F  [:file:]
4386   \g \G  [:graph:]
4387   \w \W  [:ident:], alphanumeric (plus '_')
4388   \l \L  [:lower:]
4389   \o \O  [:octal:]
4390   \p \P  [:print:], printable (note that space is printable)
4391   \q \Q  [:punct:]
4392   \s \S  [:space:]
4393   \u \U  [:upper:]
4394   \x \X  [:xdigit:]
4395          A range is a sequence of characters enclosed in `[]'. It normally
4396          matches any single character from the sequence. If the sequence
4397          begins with `^', it matches any single character not from the rest
4398          of the sequence. If two characters in the sequence are separated by
4399   [ ]    `-', this is shorthand for the full list of ASCII characters
4400          between them (e.g. `[0-9]' matches any decimal digit). To include a
4401          literal `]' in the sequence, make it the first character (following
4402          a possible `^'). To include a literal `-', make it the first or
4403          last character.
4404          Additionally for vile, if "ignorecase" is set, then all literal
4405          matches, including those in character classes, are done without
4406          regard to upper and lower case.
4407          In magic mode, the following set of metacharacters must be preceded
4408          by '\' to hide their special meaning: * [ . ^ $ These characters
4409          are special if they _are_ preceded with a '\': ? + ( ) | < >
4410          If magic mode is _not_ on, only ^ and $ are special if not escaped.
4411          All of the following must be preceded with a '\' to be special,
4412          otherwise they are taken literally: ? + ( ) | * [ . < >
4413          Replacement subexpressions are supported when substituting. That
4414          is, if part of an expression is contained in \( and \), then the
4415   \1 \9  part of the matched text in between those symbols will be
4416          substituted for an occurrence of \1 in the replacement pattern. Up
4417          to 9 such substitutions can be made. The special symbol & will &
4418          substitute for the entire match string.
4419          The tilde (~) character will expand immediately when it is typed to
4420          be the contents of the previously entered replacement pattern. [
4421     ~    Earlier versions of vile made this version of the pattern available
4422          immediately, as a default response, but this made it difficult to
4423          substitute nothing after previously substituting something. ]
4424          The replacement part of the substitution may also contain the
4425          special sequences \U and \L, which cause the replacement to be
4426   \U \L  forced to uppercase or lowercase until a terminating \E is found;
4427     \E   \u and \l, which force the case of a single character; and \b, \f,
4428   \u \l  \r, \t, \n, which insert the usual ASCII character. Note that vile
4429   \bfrtn mimics perl's handling of \u\L\1\E instead of vi's. Given
4430          :s/\(abc\)/\u\L\1\E/ vi will replace with "abc" whereas vile and
4431          perl will replace with "Abc". This is somewhat more useful for
4432          capitalizing words.
4433
4434
4435Command files
4436-------------
4437   On startup, in the absence of '@' arguments, vile attempts to read the
4438   file ".vilerc" ("vile.rc" on non-Unix hosts) in the current directory,
4439   then in $HOME, and then in several host-specific locations (see the
4440   "Invocation" topic below for complete details). If found, vile executes
4441   the startup file's commands. It is possible to nest such executions. For
4442   example, you might keep your general default settings in your home
4443   directory, and put the following lines in a .vilerc in a directory in
4444   which you prefer tabs be set to 4 spaces:
4445
4446     source "$HOME/.vilerc"
4447     set tabstop 4
4448
4449   The quotes surrounding the filename are necessary to protect the name from
4450   interpretation as a vile variable, since it starts with the '$' character.
4451
4452   Files can be executed at any time with the ":source" (or ":execute-file")
4453   command. There are control structures available, such as ~while, ~if, etc.
4454   Refer to the file doc/macros.doc which is distributed with vile for more
4455   information.
4456
4457   Nesting of source'd files is limited to a depth of ten, to prevent
4458   infinite recursion.
4459
4460   The ';' character can be used as a comment character in command files, but
4461   not necessarily on the same line as valid commands. Put your comments on
4462   separate lines to be safe.
4463
4464
4465Invocation
4466----------
4467   vile searches for a startup or command file in these locations (and in the
4468   order listed):
4469
4470         1 - current working directory
4471         2 - directory specified by $HOME
4472         3 - if host is not Unix
4473                 vile executable directory
4474             fi
4475         4 - each directory specified in $VILE_STARTUP_PATH.  If
4476             this environment variable is not set, the following
4477             host-specific defaults are internally assumed:
4478
4479             VMS:  sys$login,sys$sysdevice:[vmstools],sys$library
4480
4481             DOS, OS/2 and Win32:  /sys/public;/usr/bin;/bin;/
4482
4483             Unix:  depends on whether or not $VILE_STARTUP_PATH was
4484                    set when vile was configured prior to
4485                    compilation.  If set, then the value of that
4486                    environment var is compiled into the editor,
4487                    else the default configure "datadir" is
4488                    selected, which is either:
4489
4490                    /usr/local/share/vile   (typical root build)
4491                    ${prefix}/share/vile    (nonroot build)
4492
4493         5 - if host is not Unix, each directory specified in:
4494                 $PATH
4495                 $VILE_LIBDIR_PATH
4496             fi
4497
4498   If the variable VILEINIT is set in the environment, it is used as a set of
4499   vile commands to initialize the editor. As a not-very-useful example of a
4500   VILEINIT sequence, the following setting recreates portions of the default
4501   initialization behavior:
4502
4503     export VILEINIT
4504     VILEINIT="
4505     ~if &rd \"./.vilerc\"
4506             source \"./.vilerc\"
4507     ~else
4508             ~if &rd \"$HOME/.vilerc\"
4509                     source \"$HOME/.vilerc\"
4510             ~endif
4511     ~endif"
4512
4513   Other environment variables:
4514
4515   VILE_ERROR_ABORT
4516           if VILE_ERROR_ABORT is defined during compilation, setting this
4517           environment variable at runtime will cause vile to abort (and dump
4518           core) rather than attempt to cleanup and exit with an error code
4519           on fatal errors. This is used for debugging.
4520
4521   VILE_HELP_FILE
4522           override the name of the help file, normally "vile.hlp". This sets
4523           the $helpfile variable.
4524
4525   VILE_LIBDIR_PATH
4526           override the search path for filter programs, normally the
4527           library-directory on UNIX systems. This sets the $libdir-path
4528           variable, which is appended to your $PATH variable when running
4529           filter commands on UNIX and Win32.
4530
4531   VILE_LOCALE_MAPPING
4532           override the pattern used to associate wide/narrow locales. vile
4533           uses this to compute a possible 8-bit "narrow" locale which
4534           corresponds to the current locale, thereby supporting editing of
4535           wide- and narrow-encoded text.
4536
4537           The default value, /\\.\\(UTF\\|utf\\)[-]\\?8$//, simply strips
4538           the most common suffixes used for wide-character locales. For
4539           example, "en_US.UTF-8" would be converted to "en_US". If your
4540           computer's locale tables do not support that, you can modify the
4541           pattern to help vile find the narrow locale value that works.
4542
4543   VILE_MENU
4544
4545   XVILE_MENU
4546           if set, overrides the compiled-in location of the menu file used
4547           by xvile. If $VILE_MENU is unset, xvile checks the $XVILE_MENU
4548           variable (or XMVILE_MENU, if the program is renamed xmvile, etc).
4549
4550   VILE_NROFF_FILT
4551           if set, overrides the choice between "nroff" and "cawf" (depending
4552           on platform) in the ShowFormatted macro (^X-n). You may want to
4553           set this to "groff" if your system has groff installed, for
4554           instance, but relies on an antique version of nroff for manpages.
4555
4556   VILE_PWD
4557           if set, assume invoking shell's "$PWD" variable is valid, and use
4558           that rather than an initial getcwd() call.
4559
4560   VILE_SPELL_FILT
4561           if set, overrides the compiled-in program name and options for the
4562           spell-filter. Normally that is a string such as "spell -l"
4563
4564   VILE_STARTUP_FILE
4565           override the name of the startup file, normally ".vilerc" (or
4566           "vile.rc" for non-UNIX systems).
4567
4568   VILE_STARTUP_PATH
4569           override the search path for the startup and help files. This sets
4570           the $startup-path variable.
4571
4572   VILE_TABLE_FILT
4573           if set, indicates that "tbl" is available. Set this to "cat" if
4574           you do not want to use "tbl", but do want to use "nroff", etc (see
4575           VILE_NROFF_FILT). It is used in the ShowFormatted macro (^X-n).
4576
4577   Note: For simplification, the filters.rc script assumes that the filter
4578   programs are in $PATH. The $libdir-path feature may not work for you
4579   out-of-the-box, since your shell's initialization file (e.g., ".cshrc")
4580   may set $PATH. One solution (other than adding /usr/local/lib/vile to
4581   $PATH) is to set the vile variable $shell to /bin/sh, assuming you have no
4582   Bourne shell ".profile" to set $PATH. Then vile's modification of $PATH
4583   affects the filter process and also runs faster.
4584
4585  Command line options
4586
4587   The command line options are fairly straightforward. vile supports running
4588   just _any_ command after a '+', as does vi. It also has some shortcut
4589   options to support the commonly used '+400' to go to line 400 and '+/foo'
4590   to search for foo. Command files can be explicitly executed on startup by
4591   prefixing them with the '@' character, as in "vile @mycmds file.c". This
4592   will suppress the operation of VILEINIT and the .vilerc files.
4593
4594   -?
4595           print the usage message.
4596
4597   -c command
4598           will execute the given command after loading the first file.
4599
4600   +NNN and -gNNN
4601           vile will begin the session on the first file at the specified
4602           line number.
4603
4604   +/pattern or -s pattern
4605           In the first file, vile will execute an initial search for the
4606           given pattern.
4607
4608   -t tag
4609           vile will edit the correct file and move the cursor to the
4610           location of the tag. This requires a tagsfile created with the
4611           ctags(1) command.
4612
4613   -h
4614           Invokes vile on the helpfile.
4615
4616   -v
4617           Invokes vile in "view" mode - no changes are permitted to the
4618           buffer in this mode. (This will also be true if vile is invoked as
4619           view.)
4620
4621   -V
4622           vile will report its version number.
4623
4624   @cmdfile vile will run the specified file as its startup file, and will
4625   bypass any normal startup file (i.e. .vilerc) or environment variable
4626   (i.e. $VILEINIT).
4627
4628
4629Encryption
4630----------
4631   vile implements an interface to the UNIX crypt function, like standard vi,
4632   and can apply this to your buffers either automatically (via a mode
4633   setting) or manually (via an explicit command). The algorithm is
4634   reversible, so encrypting a previously encrypted buffer will undo that
4635   encryption.
4636
4637   The encryption key for a buffer will be a) inherited from the global
4638   cryptkey which was set via the vile command line (-k) if it exists, b) set
4639   with the set-crypt-key (^X-X) command, or c) obtained from the user
4640   interactively. The details of this are a little messy, and should probably
4641   be cleaned up somewhat. The buffer's key will remain active until changed
4642   or reset.
4643
4644   If "crypt" mode is on, then when the buffer is written the user will be
4645   prompted for the encryption key to use if none has yet been set. If
4646   "crypt" mode is on, and an encryption key has been set, then the buffer
4647   will be encrypted when read. In practice this means you need to read the
4648   file, then set crypt mode, then reread the file. (Or, equivalently, create
4649   the buffer, set crypt mode, and then insert the file into it (with ":r").
4650
4651   As an alternative to UNIX crypt, the collection of macros in the file
4652   macros/gnugpg.rc facilitates use of GNU's gpg encryption package. gpg and
4653   gnugpg.rc work well on both Unix and win32 hosts.
4654
4655
4656Crash Recovery
4657--------------
4658   The "vi -r" option, used to recover an edited buffer after a system crash,
4659   is not present in vile. If vile itself crashes (usually (though
4660   infrequently :-) due to a bug, but perhaps due to an externally applied
4661   signal), it attempts to save any modified buffers in a temporary directory
4662   and, on a Unix host, sends mail to the user to that affect. The selection
4663   of the temporary directory is host-specific, as follows:
4664
4665  Unix (in priority order)
4666
4667     $TMPDIR/vileDXXXXXX
4668     /var/tmp/vileDXXXXX
4669     /usr/tmp/vileDXXXXX
4670     /tmp/vileDXXXXXX
4671     ./vileDXXXXXX
4672
4673  DOS and OS/2
4674
4675   Saved buffers are written to disk using the path ./V<buffername> .
4676
4677  All other hosts (in priority order)
4678
4679     $TMPDIR/vileDXXXXXX
4680     ./vileDXXXXXX
4681
4682   where "XXXXXX" is a unique suffix created by mktemp().
4683
4684   If system crashes are frequent on your system, you should stop using it.
4685   You might also consider the "autosave" and "autowrite" options, which will
4686   cause more frequent saves of your work.
4687
4688
4689Mode line customization
4690-----------------------
4691   At the bottom of each window is a mode (or "status") line which is used
4692   for displaying certain characteristics of the window and the buffer
4693   associated with it. On most displays, this mode line will be highlighted
4694   in reverse video or via other means in order to visually separate windows
4695   and to distinguish the mode line from text displayed in the window.
4696
4697   The editor variable "modeline-format" is set to a string which controls
4698   formatting of mode lines. This variable is user settable and thus may be
4699   used to customize the display of mode lines. The format specifiers which
4700   may appear in the format control strings are as follows:
4701
4702   +------------------------------------------------------------------------+
4703   | Format  | Description                                                  |
4704   |---------+--------------------------------------------------------------|
4705   | %b      | buffer name                                                  |
4706   |---------+--------------------------------------------------------------|
4707   | %c      | column number if "ruler" is set                              |
4708   |---------+--------------------------------------------------------------|
4709   | %C      | character value at current edit-position.                    |
4710   |---------+--------------------------------------------------------------|
4711   | %f      | file name when not internal buffer and when not the same as  |
4712   |         | the buffer name.                                             |
4713   |---------+--------------------------------------------------------------|
4714   | %F      | file name when it is internal buffer name and not the same   |
4715   |         | as the buffer name.                                          |
4716   |---------+--------------------------------------------------------------|
4717   |         | insert/overwrite/replace mode indicator, displayed only when |
4718   | %i      | in insert, overwrite, or replace mode. When not in one of    |
4719   |         | these modes, the separator character (often "-", "=", or "   |
4720   |         | ") will be displayed.                                        |
4721   |---------+--------------------------------------------------------------|
4722   | %l      | line number to be displayed if "ruler" is set                |
4723   |---------+--------------------------------------------------------------|
4724   | %L      | number of lines in buffer, if ruler is set                   |
4725   |---------+--------------------------------------------------------------|
4726   | %m      | major mode(s), e.g., cmode, view-only, etc. Displayed in     |
4727   |         | square brackets.                                             |
4728   |---------+--------------------------------------------------------------|
4729   | %M      | brief version of "%m", omitting "mode", etc.                 |
4730   |---------+--------------------------------------------------------------|
4731   | %n      | file leaf name when not internal buffer name, otherwise the  |
4732   |         | buffer name.                                                 |
4733   |---------+--------------------------------------------------------------|
4734   | %N      | absolute file path when not internal buffer name, otherwise  |
4735   |         | the buffer name.                                             |
4736   |---------+--------------------------------------------------------------|
4737   | %p      | line number as percentage of number of lines if "ruler" is   |
4738   |         | set                                                          |
4739   |---------+--------------------------------------------------------------|
4740   | %P      | line number as percentage of number of lines                 |
4741   |---------+--------------------------------------------------------------|
4742   | %r      | relative file name when not internal buffer name, otherwise  |
4743   |         | the buffer name.                                             |
4744   |---------+--------------------------------------------------------------|
4745   |         | rough position of window with respect to buffer (top, bot,   |
4746   | %S      | all, emp, mid) when ruler not set (or ruler is set, but      |
4747   |         | buffer is empty).                                            |
4748   |---------+--------------------------------------------------------------|
4749   |         | middle separator; should appear at most once in a format     |
4750   | %=      | string. This indicates where to separate the left and right  |
4751   |         | hand portions of the mode line with a long string of dashes  |
4752   |         | (or whatever the separator character is).                    |
4753   |---------+--------------------------------------------------------------|
4754   | %-      | single occurrence of separator character                     |
4755   |---------+--------------------------------------------------------------|
4756   | %|      | eighty column indicator                                      |
4757   |---------+--------------------------------------------------------------|
4758   | %%      | percent sign                                                 |
4759   |---------+--------------------------------------------------------------|
4760   | %:      | colon                                                        |
4761   |---------+--------------------------------------------------------------|
4762   | %{name} | any internal mode/variable value, given its name             |
4763   +------------------------------------------------------------------------+
4764
4765   Some of the format specifiers (%f, %F, %m, %l, %c, %p, %S, %L, %C) are
4766   conditionally displayed. For example "%m" will display the major modes
4767   only if there are some major modes set or if the buffer has been modified
4768   (which is sort of a major mode). Similarly, "%F" and "%f" will cause the
4769   associated file name to be displayed when the buffer is of the appropriate
4770   type (a scratch buffer or not) and the shortened file name is different
4771   from the buffer name. It is desirable at times to cause a prefix string
4772   and/or a suffix string to be emitted along with the string obtained after
4773   conversion of the format specifier. This may be done by following the
4774   format specifier with a colon, the prefix string, another colon, the
4775   suffix string, and another colon. For example, "%l:(:,:%c::) :" might be
4776   used to display the line and column number for "ruler" mode. Note that
4777   either or both of the prefix and suffix strings may be empty.
4778
4779   Characters in the string which are not part of a format specifier are
4780   output verbatim.
4781
4782   The default format control string is as follows:
4783
4784     "%-%i%- %b %m:: :%f:is : :%=%F: : :%l:(:,:%c::) :%p::% :%C:char ::%S%-%-%|"
4785
4786   Mode lines for some versions of vile previous to version 4.7 can be
4787   obtained with the following format string. This will remove the percentage
4788   indication from the mode line when in ruler mode and also shift the ruler
4789   indicator to the far right in the mode line.
4790
4791     "%-%i%- %b %m:: :%f:is : :%=%F: : %-%-%-%-:%l:(:,:%c::):%S::%-%-:%|"
4792
4793
4794Color basics
4795------------
4796   The editor's support of color varies from host to host. On some hosts,
4797   such as VMS and DOS, limited capability exists. On other hosts, full-blown
4798   syntax coloring is provided for a wide variety of languages and tools.
4799   Prior to discussing the ins and outs of syntax coloring, it helps to first
4800   describe several key color features and concepts.
4801
4802  Console/standard vile versus GUI vile
4803
4804   Depending on the host, vile comes in two flavors:
4805
4806     * console (or "standard") vile, which displays text with block
4807       character, cursor-based addressing.
4808     * GUI vile (aka, winvile on a win32 host and xvile on a Unix host),
4809       which displays text using the host's GUI APIs.
4810
4811   In general, GUI vile supports a richer set of color features and
4812   capabilities than console vile.
4813
4814  Color palette
4815
4816   Depending on the capabilities of the host operating system and the
4817   underlying display hardware, vile supports a palette of up to 16 colors.
4818   The editor's color names are fixed, as shown in this list:
4819
4820   +-----------------------------------------+
4821   | External user name | Internal vile name |
4822   |--------------------+--------------------|
4823   | black              | C0                 |
4824   |--------------------+--------------------|
4825   | red                | C1                 |
4826   |--------------------+--------------------|
4827   | green              | C2                 |
4828   |--------------------+--------------------|
4829   | brown              | C3                 |
4830   |--------------------+--------------------|
4831   | blue               | C4                 |
4832   |--------------------+--------------------|
4833   | magenta            | C5                 |
4834   |--------------------+--------------------|
4835   | cyan               | C6                 |
4836   |--------------------+--------------------|
4837   | lightgray          | C7                 |
4838   |--------------------+--------------------|
4839   | gray               | C8                 |
4840   |--------------------+--------------------|
4841   | brightred          | C9                 |
4842   |--------------------+--------------------|
4843   | brightgreen        | CA                 |
4844   |--------------------+--------------------|
4845   | yellow             | CB                 |
4846   |--------------------+--------------------|
4847   | brightblue         | CC                 |
4848   |--------------------+--------------------|
4849   | brightmagenta      | CD                 |
4850   |--------------------+--------------------|
4851   | brightcyan         | CE                 |
4852   |--------------------+--------------------|
4853   | white              | CF                 |
4854   +-----------------------------------------+
4855
4856   Note that both xvile and winvile provide support for the mapping of
4857   arbitrary RBG values to the above color names, thus permitting the
4858   creation of a customized color palette.
4859
4860  xvile custom colors
4861
4862   When a color X server and color display are available, xvile's default
4863   colors are modified by changing the editor's color resources (refer to the
4864   topic "X Resources" in this help file). So, for example, the following
4865   line in an .Xdefaults or .Xresources file maps "gray" above to red:
4866
4867     XVile.color.fcolor8: rgb:ff/0/0
4868
4869   or
4870
4871     XVile.color.fcolor8: red
4872
4873  winvile custom colors
4874
4875   winvile's default colors are changed via the editor's set-rgb-palette
4876   command. Mirroring the example above, map "gray" to red like so:
4877
4878     set-rgb-palette gray 255 0 0
4879
4880  Display attributes
4881
4882   vile supports bold, italic, underline, and reverse display attributes.
4883   These attributes may be used to modify/enhance any of the existing colors
4884   (e.g., bold blue), or render text as a "color" in its own right (e.g.,
4885   configure the editor to highlight all matched search strings in the
4886   reverse attribute).
4887
4888  Show-colors command
4889
4890   The show-colors command (i.e., ":show-colors") displays the editor's
4891   current color and attribute mappings.
4892
4893  Xterms, terminfo, and termcap (Unix hosts only)
4894
4895   Note that on some unix hosts it's possible to run standard vile in a color
4896   xterm and thereby gain access to an expanded color palette (albeit often
4897   limited to 8 colors). However, this is only possible when:
4898
4899     * your terminal type (specified via the $TERM environment var) supports
4900       color, and
4901     * vile is compiled and linked with the terminfo library.
4902
4903   Hint 1: Modern xterm and similar terminal emulators support 8 colors
4904   (i.e., ensure that the correct $TERM is used, e.g., "export TERM=xterm" or
4905   csh equiv is included in your shell startup file).
4906
4907   Hint 2: To determine if the editor was compiled with terminfo, type
4908   :show-variables and examine the value of $cfgopts. If this variable
4909   includes the string "terminfo", you've got a shot. If "termcap" is listed
4910   instead, vile's color palette is limited to black and white (i.e., no
4911   color). Assuming your host supports terminfo, the following build commands
4912   force the editor to use that library:
4913
4914     $ make clean; ./configure --with-ncurses; make
4915
4916   For additional hints and help, try this URL:
4917
4918     http://invisible-island.net/xterm/xterm.faq.html#no_color
4919
4920  Visual matching (VM)
4921
4922   All hosts support visual-matches mode, which highlights search text with
4923   either a simple color (no modifiers) or a display attribute. To see the
4924   list of supported colors and attributes, type:
4925
4926     :set visual-matches=<tab><tab>
4927
4928   To learn more about this mode, search for "visual-matches" elsewhere in
4929   this help file.
4930
4931  Foreground color (FC)
4932
4933   On hosts and display hardware that support it, the editor's foreground
4934   color may be set to a simple color value (no attribute modifiers allowed).
4935   Type:
4936
4937     :set fcolor=<tab><tab>
4938
4939   for a list of supported colors.
4940
4941  Background color (BC)
4942
4943   On hosts and display hardware that support it, bcolor mode sets the
4944   editor's background color. Bcolor utilizes the same color list as fcolor.
4945
4946  Attribute control sequences (ACS)
4947
4948   A buffer may be manually or programmatically encoded with strings that
4949   cause the editor to render text in arbitrary color/attribute sequences.
4950   For example, consider the following data:
4951
4952         ^A3C1:red text, ^A4B:bold text
4953
4954   Given a suitable command, vile will render this as:
4955
4956         <begin red>red<end red> text, <begin bold>bold<end bold> text
4957
4958   It's possible to mix colors and attribute as well:
4959
4960         ^A8BC1:bold red text
4961
4962   which is rendered as:
4963
4964         ^A8BC1:<begin bold&red>bold red<end bold&red> text
4965
4966   These sequences are the building blocks of syntax coloring. For a more
4967   detailed discussion of attribute control sequences, refer to the topic
4968   "Writing your own filters" in this help file.
4969
4970  Syntax coloring (SC)
4971
4972   vile colors a buffer via these steps:
4973
4974    1. an external filter (e.g., vile-c-filt) is run and subsequently reads
4975       an optional keywords file and a color specification file. The latter
4976       maps classes of language keywords/elements to user-specified colors
4977       and display attributes.
4978    2. the filter reads the buffer being colored from stdin and encodes
4979       language keywords/elements with attribute control sequences.
4980    3. the filter writes its results to stdout, which vile reads back and
4981       uses as control information to color the buffer.
4982    4. the editor redraws its display, appropriately rendering all
4983       attribute-encoded keywords (e.g., "if", "while") and other syntactic
4984       elements (e.g., strings and numbers), based on the information
4985       embedded in the filter's output.
4986
4987  Host capability matrix
4988
4989   +------------------------------------------------------------------------+
4990   |Color Feature |VMS     |VMS    |DOS|OS/2|Win32  |Win32  |Unix   |Unix   |
4991   |              |(std)   |(GUI)  |   |    |(std)  |(GUI)  |(std)  |(GUI)  |
4992   |--------------+--------+-------+---+----+-------+-------+-------+-------|
4993   |Visual        |Y       |Y      |Y  |Y   |Y      |Y      |Y      |Y      |
4994   |Matching      |        |       |   |    |       |       |       |       |
4995   |--------------+--------+-------+---+----+-------+-------+-------+-------|
4996   |Foreground    |N       |Y      |Y  |Y   |Y      |Y      |[2]    |Y      |
4997   |Color         |        |       |   |    |       |       |       |       |
4998   |--------------+--------+-------+---+----+-------+-------+-------+-------|
4999   |Background    |N       |Y      |Y  |Y   |Y      |Y      |[2]    |Y      |
5000   |Color         |        |       |   |    |       |       |       |       |
5001   |--------------+--------+-------+---+----+-------+-------+-------+-------|
5002   |Attr.         |Y       |Y      |Y  |Y   |Y      |Y      |[3]    |Y      |
5003   |Sequences     |        |       |   |    |       |       |       |       |
5004   |--------------+--------+-------+---+----+-------+-------+-------+-------|
5005   |Syntax        |N       |N      |N  |[1] |Y      |Y      |[3]    |Y      |
5006   |Coloring      |        |       |   |    |       |       |       |       |
5007   +------------------------------------------------------------------------+
5008
5009   Note 1: vile's filter mechanism blocks (hangs) when processing "large"
5010   buffers. Consequently, syntax coloring is not recommended, except if one
5011   could use the builtin-filters configuration.
5012
5013   Note 2: Requires a terminfo terminal type that supports color.
5014
5015   Note 3: If a terminal type supporting color is unavailable, then
5016   "coloring" is limited to the use of attributes like bold, underline, etc.
5017
5018
5019Syntax coloring
5020---------------
5021   vile's source distribution includes an extensive set of filters that color
5022   many languages and text file formats, including (but not limited to):
5023
5024   C/C++, Java, Perl, HTML, shell scripts
5025
5026   Filters come in two flavors: builtin and external. Builtin filters are
5027   bound directly into the editor and invoked via function calls. External
5028   filters are standalone executables invoked via a pipe and typically named
5029   "vile-xxx-filt", where "xxx" denotes the target text/language. Note that
5030   "xxx" is usually the same name assigned to vile's corresponding builtin
5031   filter and "majormode" (there are some exceptions). The following table
5032   lists example paired filter and majormode names:
5033
5034   +------------------------------------------------------------------------+
5035   | Language Name | Builtin       | External Filter Name  | Majormode      |
5036   |               | Filter Name   | [1]                   | Name[2]        |
5037   |---------------+---------------+-----------------------+----------------|
5038   | C             | c             | vile-c-filt           | cmode          |
5039   |---------------+---------------+-----------------------+----------------|
5040   | HTML          | html          | vile-html-filt        | htmlmode       |
5041   |---------------+---------------+-----------------------+----------------|
5042   | Perl          | pl            | vile-pl-filt          | perlmode       |
5043   |---------------+---------------+-----------------------+----------------|
5044   | sh            | sh            | vile-sh-filt          | shmode         |
5045   +------------------------------------------------------------------------+
5046
5047   For a complete listing of all filters and supported languages and text
5048   file formats, refer to the file doc/config.doc in the editor's source
5049   distribution.
5050
5051   [1] Whether the editor uses builtin or external filters depends solely
5052   upon configuration options specified when the editor is compiled and
5053   linked (see doc/config.doc for details). As you might expect, builtin
5054   filters offer faster syntax coloring at the cost of a larger editor
5055   executable. For the purposes of this document, it's assumed that the
5056   editor is bound with builtin filters.
5057
5058   [2] Majormodes are an interesting subject in their own right, but won't be
5059   discussed much within the context of syntax coloring. For more info, refer
5060   to the help topic "Majormodes" in this help file, as well as the file
5061   doc/modes.doc.
5062
5063   [3] Previous releases of vile utilized a syntax filtering system that
5064   actually applied color attributes to a target buffer, thereby damaging the
5065   editor's undo history. vile version 8.3 (and later) utilizes a new
5066   command, called "attribute-from-filter-til", which applies coloring
5067   information directly from the filter's output stream without modifying the
5068   affected buffer.
5069
5070   The remainder of this section of the help file includes a step-by-step
5071   description of syntax coloring configuration, as well as pointers to
5072   related features.
5073
5074  Prerequisites
5075
5076     * be familiar with the help topic entitled "Color basics".
5077     * ensure the target host supports syntax coloring.
5078     * if on a Unix host, compile and link the editor from the source
5079       distribution. This step is optional on a win32 host, as precompiled
5080       binaries (editor and filters) are available from
5081       ftp://ftp.invisible-island.net/vile/ . Note that almost all filters
5082       require preprocessing with flex (not a standard Windows tool) prior to
5083       compilation.
5084
5085  Configuration
5086
5087   There are three configuration recipes, each dependent on the target host
5088   and/or the user's privilege level.
5089
5090  Unix install recipe - root privileges available
5091
5092   The simplest install copies the editor to a directory in the system PATH
5093   (we'll assume /usr/local/bin), and copies all syntax coloring data and
5094   macro files to /usr/local/share/vile. The following commands accomplish
5095   that task:
5096
5097     unset VILE_STARTUP_PATH VILE_LIBDIR_PATH
5098     make clean; ./configure --with-builtin-filters; make
5099     make install
5100
5101   Users should take these additional steps:
5102
5103   1) add the following to their $HOME/.vilerc startup files:
5104
5105     source "filters.rc"
5106
5107   2) execute these shell commands (as necessary):
5108
5109     mkdir $HOME/.vile
5110     cp /usr/local/share/vile/vile.keywords $HOME/.vile
5111
5112   That's it. Now skim through the "Manual recipe" topic below and then pay
5113   attention again when you hit the topic entitled "Testing the
5114   configuration". With regard to the remainder of this discussion, the term
5115   "COLORDIR" refers collectively to the list of directories where vile
5116   searches for keyword files. This is the list:
5117
5118     * the current directory
5119     * the home directory
5120     * the vile subdirectory of the home directory
5121     * the directories listed in $startup-path.
5122
5123   When searching directories which it does not "own;", vile looks for the
5124   filename with a leading ".;". The which-keywords macro illustrates this
5125   best, e.g.,
5126
5127     which-keywords cmode
5128
5129   produces this output in the [Which Keywords] buffer:
5130
5131         Show which keyword-files are tested for:
5132                 cmode
5133         (* marks found-files)
5134
5135         $cwd
5136           ./.c.keywords
5137         $HOME
5138           ~/.c.keywords
5139           ~/.vile/c.keywords
5140         $startup-path
5141         * /usr/share/vile/c.keywords
5142
5143  Unix install recipe - no privileges
5144
5145   The simplest install copies the editor and all data and macros file to a
5146   writable directory tree (we'll assume $HOME/local). This syntax does the
5147   job:
5148
5149     unset VILE_STARTUP_PATH VILE_LIBDIR_PATH
5150     make clean
5151     ./configure --prefix=$HOME/local --with-builtin-filters
5152     make
5153     make install
5154
5155   These additional steps are required:
5156
5157   1) add the following to the $HOME/.vilerc startup file:
5158
5159     source "filters.rc"
5160
5161   2) execute these shell commands (as necessary):
5162
5163     mkdir $HOME/.vile
5164     cp $HOME/local/share/vile/vile.keywords $HOME/.vile
5165
5166   3) add $HOME/local/bin to $PATH (if not already specified)
5167
5168   That's it. Now skim through the "Manual recipe" topic below and then pay
5169   attention again when you hit the topic entitled "Testing the
5170   configuration". With regard to the remainder of this discussion, the term
5171   "COLORDIR" refers collectively to the directories $HOME/.vile or
5172   $HOME/local/share/vile as appropriate.
5173
5174  Manual Recipe - Win32 host
5175
5176   You may choose to not use the winvile install/setup program, or else you
5177   may be installing console Win32 vile. In either case, you can always
5178   manually configure vile for Win32. For the purposes of this discussion, it
5179   is assumed that the editor is not built from sources, but instead obtained
5180   from precompiled binaries, as described next.
5181
5182   1) create a directory (hereafter referred to as COLORDIR) to store the
5183   editor's external color keyword and macro files. Example COLORDIR name:
5184   c:\util\vcolor
5185
5186   2) obtain these two distributions:
5187
5188     ftp://ftp.invisible-island.net/vile/filters.zip
5189     ftp://ftp.invisible-island.net/vile/vile-w32.zip
5190
5191   3) extract the contents of filters.zip into COLORDIR.
5192
5193   4) extract the contents of vile-w32.zip into a temp directory. From within
5194   this temp directory:
5195
5196   a) copy *.rc to COLORDIR. Note that the most important of these files is
5197   filters.rc .
5198
5199   b) copy vile.exe, vile.hlp, and winvile.exe to a directory in your PATH.
5200   Note that vile.exe and winvile.exe are both bound with _all_ of the
5201   editor's builtin filters.
5202
5203   5) edit your startup file (vile.rc) and add this line:
5204
5205     source "filters.rc"
5206
5207   6) export these environment variable settings:
5208
5209         VILE_STARTUP_PATH=COLORDIR
5210         VILE_LIBDIR_PATH=COLORDIR
5211
5212   Example entries in Win9x/ME's autoexec.bat:
5213
5214     SET VILE_LIBDIR_PATH=c:\util\vcolor
5215     SET VILE_STARTUP_PATH=c:\util\vcolor
5216
5217   On a Win/NT/2K host, env vars are initialized via a control panel applet.
5218   WinXP uses a different mechanism.
5219
5220  Testing the configuration
5221
5222   Basic configuration is now complete. Filters.rc installs several stored
5223   procedures, including:
5224
5225   +------------------------------------------------------------------------+
5226   | Macro Name         | Binding | Function                                |
5227   |--------------------+---------+-----------------------------------------|
5228   | HighlightFilterMsg | ^X-q    | Colors the current buffer if a          |
5229   |                    |         | majormode and filter exist for same.    |
5230   |--------------------+---------+-----------------------------------------|
5231   | HighlightClear     | ^X-Q    | Clears the current buffer's color       |
5232   |                    |         | attributes.                             |
5233   |--------------------+---------+-----------------------------------------|
5234   | set-highlighting   | <none>  | Attach a major mode to a buffer and     |
5235   |                    |         | re-color same. More about this below.   |
5236   +------------------------------------------------------------------------+
5237
5238   For a simple go/no-go test, do:
5239
5240     * edit a C source file
5241     * examine the editor's modeline and ensure that "[cmode]" is in effect
5242     * type ^X-q
5243
5244   If all is well, various elements of the C program will be
5245   highlighted/colored. You may not particularly care for the color
5246   attributes chosen, but that's configurable (keep reading :-) ). If nothing
5247   happened, skip down to the troubleshooting section.
5248
5249  Read-hook
5250
5251   Typing ^X-q each time a new file is opened gets old after awhile. To force
5252   the editor to take over this task, add this line to your startup file:
5253
5254     setv $read-hook HighlightFilterMsg
5255
5256   This setting initiates syntax coloring whenever a new file is edited.
5257   However, note that the read-hook won't initiate syntax coloring when a
5258   buffer's contents change, which brings us to the next topic.
5259   HighlightFilterMsg is a wrapper for the macro HighlightFilter, which adds
5260   a message saying that it is updating attributes. If you prefer no
5261   messages, use HighlightFilter.
5262
5263  Autocolor
5264
5265   It's possible to automatically initiate syntax coloring when the editor
5266   detects no active input during a user-configurable interval. If this
5267   sounds appealing, add the following to your startup file:
5268
5269     ; change autocolor mode value to suit individual tastes
5270     set autocolor=2000
5271     setv $autocolor-hook HighlightFilterMsg
5272
5273   These settings initiate an automatic syntax coloring check whenever 2
5274   seconds of idle time elapses (autocolor's argument is scaled in
5275   milliseconds). Note that autocolor won't actually invoke a syntax filter
5276   unless it detects a modified buffer.
5277
5278   To disable this feature, set autocolor to 0 (zero).
5279
5280   Note that "autocolor" is a buffer mode and as such, can be enabled
5281   globally, but disabled for one or more buffers where coloring is
5282   inappropriate. That is, type ":setl autocolor=0" to disable the automatic
5283   syntax coloring for a particular buffer.
5284
5285   For obvious reasons, this feature is less "intrusive" on fast hardware.
5286   Even on fast hardware, running an external syntax filter can be a little
5287   slow. The built-in filters run much faster, fast enough that this
5288   combination is not that intrusive. The filters.rc script checks if vile
5289   has built-in (or loadable) syntax filters and will turn on autocolor and
5290   the $read-hook automatically in this case (with a 5 second idle time).
5291   Depending on the speed of your hardware, you may wish to make this
5292   shorter.
5293
5294   If autocolor is too slow, you can temporarily disable it by turning the
5295   highlighting mode off:
5296
5297     :set nohl
5298
5299  Changing color/attribute mappings
5300
5301   Filters will color text based on the contents of the file
5302   COLORDIR/vile.keywords . This file's configuration syntax is described in
5303   detail in doc/filters.doc. We'll hit the high points here:
5304
5305     * a line that begins with ':' is a comment
5306     * language elements are grouped into classes, each of which is assigned
5307       a color, using this syntax:
5308
5309     .class <name>:<ACS>
5310
5311   where:
5312
5313         <name>      ::= an arbitrary alphanumeric string.
5314         <ACS>       ::= { C<hexdigit> | U | I | B | R }
5315         C<hexdigit> ::= internal vile color name
5316           U         ::= underline attribute
5317           I         ::= italic attribute
5318           B         ::= bold attribute
5319           R         ::= reverse attribute
5320
5321   An example keyword file might contain:
5322
5323     .class Action:BC2
5324     .class Comment:BC1
5325     .class Error:CA
5326     :.class Ident:R
5327     .class Ident2:C6
5328     .class Keyword:C3
5329     .class Keyword2:BC1
5330     .class Literal:UC5
5331     .class Number:C6
5332     .class Preproc:C2
5333     .class Type:CD
5334
5335   The "Comment" class defines the color attribute applied to a language's
5336   comments, which will be rendered in "B"old "C"olor "1". "Literal" applies
5337   to string literals, which will be shown as "U"nderlined "C"olor "5".
5338   "Keyword" applies to a language's reserved words (e.g., "if", "while",
5339   "break"), which will be encoded as "C"olor "3". And so forth. Note that
5340   few filters use all of the classes listed in this file.
5341
5342   As should be obvious at this point, color configuration is effected by
5343   editing vile.keywords and applying individual tastes and preferences.
5344
5345   For completeness sake, it should be noted that the mapping of language
5346   tokens (e.g., "int", "static", "while") to vile.keyword's generic classes
5347   occurs in the individual language-specific keyword files. In general, a
5348   language-specific keyword file (e.g., COLORDIR/awk.keywords,
5349   COLORDIR/perl.keywords, COLORDIR/c.keywords) provides only part of the
5350   filter's behavior - much of its action is encoded in its source, which for
5351   most filters is written in "flex". It is not expected that users will need
5352   or want to edit these files.
5353
5354  Caution: vile.keywords is a precious file
5355
5356   From time to time, users upgrade to the latest release of vile. If the
5357   above syntax coloring configuration and installation instructions are
5358   blindly repeated during an upgrade, your copy of vile.keywords will be
5359   overwritten with the corresponding file from vile's distribution. This is
5360   not a happy event if you've spent time tweaking this file to suit your
5361   tastes (the author speaks from experience). Word to the wise:
5362
5363   Once vile.keywords is edited to your satisfaction, make a backup copy
5364   and/or save it under version control!
5365
5366  Troubleshooting
5367
5368   Try this checklist when syntax coloring doesn't work:
5369
5370     * Does your display hardware and/or host support color? Type
5371       ":show-colors" to list current capabilities. If colors/attributes
5372       appear to be missing, reread the "Color basics" topic in this help
5373       file.
5374     * Win32 users should ensure that these environment vars are properly
5375       initialized:
5376
5377         VILE_STARTUP_PATH
5378         VILE_LIBDIR_PATH
5379
5380     * Your startup file should include these lines:
5381
5382         source "filters.rc"      ; quotes matter on win32 hosts
5383         setv $autocolor-hook HighlightFilterMsg
5384         setv $read-hook HighlightFilterMsg
5385         set autocolor=2000
5386
5387     * Some users have made the mistake of explicitly specifying a filter via
5388       the filtername mode. Don't do that.
5389
5390  Attaching/Forcing a buffer's majormode
5391
5392   For the most part, when vile visits a file, the correct majormode is
5393   attached to the file's buffer and appropriate syntax coloring ensues. But
5394   there are times when vile may choose the wrong majormode and/or not
5395   specify one at all (the latter case most likely occurs when the file's
5396   suffix doesn't match any of the possibilities listed in filters.rc). The
5397   result is either inappropriate or _no_ highlighting. In this situation,
5398   use the "set-highlighting" macro to explicitly specify the desired
5399   majormode.
5400
5401   For example, suppose I'm editing an older copy of a C++ source file called
5402   main.cpp, which has been renamed to main.cpp.old . In this scenario, vile
5403   will not attach a majormode to main.cpp.old's buffer and consequently will
5404   not color the buffer. To set the proper majormode and force syntax
5405   coloring, simply type:
5406
5407     :set-highlighting cpp
5408
5409  Man pages
5410
5411   It's also possible to syntax color Unix man pages, although the procedure
5412   is not tied to a majormode. Refer to the help topic entitled 'Filtering
5413   "man" pages' for further information.
5414
5415  Spell checking (Unix hosts only)
5416
5417   The editor is capable of spell checking the current buffer (with ispell)
5418   and subsequently highlighting all misspelled words in the Keyword class
5419   color (as specified in vile.keywords). If this feature sounds useful, then
5420   add this line to your startup file:
5421
5422     source "spell.rc"
5423
5424   Spell.rc installs ^X-i as the keybinding that initiates spell checking.
5425
5426  Further reading
5427
5428   More information on syntax coloring can be found in the file
5429   doc/filters.doc, in the vile source directory.
5430
5431
5432Setting Extra Colors
5433--------------------
5434   Syntax highlighting applies to buffers which are loaded from files. vile
5435   can also generate buffers to show its internal state. Those can be colored
5436   using the "extra colors" feature. The feature is called "extra colors"
5437   both because these are colors not set via syntax filters, but also because
5438   it allows color and attribute combinations not available via the normal
5439   mode setting mechanism.
5440
5441   The show-extra-colors command shows the types of things that can be
5442   colored, along with their current state, e.g.,
5443
5444         enum             default
5445         hypertext        default
5446         isearch          default
5447         linebreak        default
5448         linenumber       default
5449         modeline         reverse
5450         number           default
5451         regex            default
5452         string           default
5453         warning          default
5454
5455   The set-extra-color command sets the colors. It prompts for the name of a
5456   type, followed by a combination of color and attributes. Use '+' to join
5457   the color and attributes. These are possible commands for setting isearch
5458   (the highlighting used for incremental search):
5459
5460     set-extra-color isearch reverse
5461     set-extra-color isearch reverse+blue
5462     set-extra-color isearch blue+reverse
5463     set-extra-color isearch blue+reverse+underline
5464     set-extra-color isearch red
5465
5466   Here is an example of how the various extra colors might be used:
5467
5468     ~if &sge &cat $version $patchlevel 'version 9.7f'
5469     ~with set-extra-colors
5470             isearch blue+underline
5471             hypertext underline+red
5472             modeline reverse+green
5473             string magenta
5474             regex underline+magenta
5475             number cyan
5476             enum green
5477     ~if &sge &cat $version $patchlevel 'version 9.7m'
5478             warning reverse+bold+red
5479     ~endif
5480     ~endwith
5481
5482
5483Majormodes
5484----------
5485   Prior to studying majormodes, it helps to be familiar with the "Editor
5486   modes" and "Syntax coloring" topics.
5487
5488   Majormodes are collections of buffer mode values that vile automatically
5489   assigns to new buffers. When the vile distribution file "filters.rc" is
5490   sourced, it in turn sources "modes.rc", which subsequently defines a
5491   significant number of majormodes for various programming languages and
5492   file formats. The majormode assigned to a particular buffer is dependent
5493   upon two criteria, in the following priority order:
5494
5495    1. the suffix of the file being edited, and
5496    2. the file's preamble (i.e., file's first line).
5497
5498   Both suffix and preamble are expressed as regular expressions and examples
5499   of each are readily available in modes.rc . Speaking of modes.rc, it
5500   becomes obvious from browsing this file that most majormode buffer
5501   settings involve specifying appropriate regex patterns for fences and
5502   comments.
5503
5504   The syntax for defining a new majormode or overriding an existing
5505   majormode is quite rich and fully described in the file doc/modes.doc.
5506   Rather than regurgitating the contents of that file here, we'll hit the
5507   high points with a couple of examples.
5508
5509   To define a new majormode, add this in your vile startup file:
5510
5511     define-mode <new_majormode_name>
5512     ~with define-submode <new_majormode_name>
5513             mode-pathname  "<regexp_pattern>"       ; see next para
5514             mode-filename  "<regexp_pattern>"       ; see next para
5515             suffixes       "<regexp_pattern>"       ; see next para
5516             preamble       "<regexp_pattern>"       ; see next para
5517             before         "<if necessary>"
5518             filtername     "<syntax-coloring-filter>"
5519             buffer mode setting#1
5520             buffer mode setting#2
5521     ; etc.
5522     ~endwith
5523
5524   Selecting file(s) for inclusion within a majormode is a matter of
5525   specifying an appropriate regular expression, like so:
5526
5527   +-----------------------------------------------+
5528   | regexp mode name | selection based on         |
5529   |------------------+----------------------------|
5530   | mode-pathname    | any file component in path |
5531   |------------------+----------------------------|
5532   | mode-filename    | leaf filename              |
5533   |------------------+----------------------------|
5534   | suffixes         | .<file_suffix>             |
5535   |------------------+----------------------------|
5536   | preamble         | first line of file         |
5537   +-----------------------------------------------+
5538
5539   One or more of these regular expressions may be specified within a
5540   majormode definition, with selection precedence given in the order listed
5541   above.
5542
5543   As an actual example, suppose someone wanted to edit this help file and
5544   subsequently submit patches to vile's developers. In the spirit of
5545   cooperation, the developers would appreciate changes that were made with
5546   the same tabstops and tab insertion policies as used in the existing help
5547   file (vile.hlp). Taking a peek at vile.hlp, it can readily be seen that
5548   physical tabs are indeed used, with stops apparently set at intervals of
5549   8. Also, it appears that the right margin is set fairly close to 80. To
5550   mirror this policy, create this new majormode:
5551
5552     define-mode hlp
5553     ~with define-submode hlp
5554             suf '\.hlp$'
5555             ts=8
5556             fillcol=77
5557             tabinsert
5558             filtername 'vile-txt-filt'
5559     ~endwith
5560
5561   Now, whenever a file with suffix ".hlp" is edited, it will be colored with
5562   vile-txt-filt and physical tabs inserted at multiples of 8.
5563
5564   To override or augment the buffer mode settings of an existing majormode,
5565   do this in your startup file:
5566
5567     source "filters.rc"
5568     ; ...
5569     define-mode <existing_majormode_name>
5570     ~with define-submode <existing_majormode_name>
5571             changed buffer mode setting#1
5572             changed buffer mode setting#2
5573             ; etc.
5574     ~endwith
5575
5576   For example, suppose it was desirable to edit all text files with
5577   ignorecase disabled. This startup file snippet will suffice:
5578
5579     source "filters.rc"
5580     ; ...
5581     define-mode txt
5582     ~with define-submode txt
5583             ignorecase
5584     ~endwith
5585
5586   Once associated, majormode submodes can be setl/unsetl just like regular
5587   local buffer modes. But note well that set/unset have no effect on
5588   submodes. So, when hlpmode is in effect, this command works:
5589
5590     setl notabinsert
5591
5592   but this command has no effect:
5593
5594     set notabinsert
5595
5596   As added syntactic sugar, majormode submodes may be prefixed with the
5597   majormode name and changed like so:
5598
5599     set/setl     txt-ignorecase
5600     set/setl     hlp-fillcol=60
5601     unset/unsetl txt-ignorecase
5602     unset/unsetl hlp-tabinsert
5603
5604  Notes
5605
5606   1) Use the command "show-majormodes" to display the list of majormodes and
5607   their associated submodes.
5608
5609   2) Only one majormode can be set for a buffer.
5610
5611   3) To override the majormode that vile assigns to a buffer, use either the
5612   set-highlighting macro (defined in filters.rc) or the "setl
5613   <majormode_name>" command. Example:
5614
5615     setl cppmode     ; <-- force cppmode for current buffer
5616
5617  Distinguishing between C/C++ include files
5618
5619   Both C and C++ use ".h" as an include file suffix. vile's current
5620   majormode definitions favor "*.h" for inclusion in cmode (not cppmode),
5621   which is not desirable for C++ programmers and/or a C++ project. There are
5622   two workarounds:
5623
5624   1) On a project-by-project basis (i.e., developer does not devote all of
5625   his/her time to C++ coding), simply add something like this to the vile
5626   startup file:
5627
5628     source "filters.rc"
5629     ; ...
5630     define-mode cpp
5631     ~with define-submode cpp
5632             mode-pathname 'project_root_directory_name/.*\.h$'
5633     ~endwith
5634
5635   This change specifies that all "*.h" files beneath a root directory name
5636   are presumed to be C++ files.
5637
5638   2) If coding C++ more than C, then make these changes:
5639
5640     source "filters.rc"
5641     ; ...
5642     define-mode cpp
5643     ~with define-submode cpp
5644             suffixes        '\.\(C\|CC\|cc\|cpp\|cxx\|hxx\|h\|hh\)$'
5645     ~endwith
5646
5647   This change adds ".h" to the list of C++ files and since vile tests
5648   cppmode before cmode, all "*.h" files will now be edited in cppmode.
5649
5650  cmode: the original vile builtin majormode
5651
5652   Long before Tom Dickey added majormodes to vile, there existed "cmode", a
5653   feature that included its own builtin tab settings and indentation style
5654   (still available today as "cindent"). This older version of cmode served
5655   as the precursor for vile's current majormode system.
5656
5657   Today, even if filters.rc is not sourced at runtime, vile includes a
5658   builtin majormode called cmode that is defined internally like so:
5659
5660     define-mode c
5661     ~with define-submode c
5662             ts=8
5663             sw=8
5664             cindent
5665             cindent-chars ":#"
5666             suffix "<complex_regexp_for_c_c++_file_suffixes>"
5667             filtername 'vile-c-filt'
5668     ~endwith
5669
5670   This builtin majormode can produce some surprising results when editing C
5671   source files. In particular:
5672
5673     set ts=<val>   ; <-- has no effect, use "setl" instead
5674
5675   What's more these settings may be anathema for the coding style in effect
5676   for a given software project. Override these settings in the vile startup
5677   file to suit your needs/taste, like so:
5678
5679     define-mode c
5680     ~with define-submode c
5681             ts=4
5682             sw=4
5683             nocindent
5684     ~endwith
5685
5686
5687Filtering "man" pages
5688---------------------
5689   When used in conjunction with the vile-manfilt program (supplied as source
5690   file filters/manfilt.c), either vile or xvile may be used to filter and
5691   view manual pages. xvile will even display (with your font set properly)
5692   certain portions of the manual page text in bold or italics as
5693   appropriate.
5694
5695   The file macros/manpage.rc (found in the vile source directory, with
5696   portions copied below) contains a macro which is bound to ^X-m. It will
5697   prompt for a manual page, filter it, attach attributes and display it in
5698   the current window. The text of manpage.rc may be either incorporated
5699   verbatim into your .vilerc file or may be read from your .vilerc as
5700   follows:
5701
5702     source "manpage.rc"
5703
5704   This assumes that you have moved the manpage.rc file to a directory known
5705   to vile (automatically handled by "make install" on Unix or,
5706   alternatively, by pointing the VILE_STARTUP_PATH env var to the directory
5707   where this file resides). If you do all of this but use vile rather than
5708   xvile, you will still end up with a legible man page, albeit without the
5709   spiffy formatting.
5710
5711   The manual page filtering program may also be used to look at other text
5712   formatted with nroff. From the vile source directory, for example, the
5713   following command will format and filter the vile manual page (which is
5714   nroff source).
5715
5716     :e !nroff -man vile.1 | vile-manfilt
5717
5718   Once loaded, it will look rather funny. There will be Cntl-A characters
5719   scattered throughout the text followed by a sequence of digits followed by
5720   one or more uppercase letters followed by a colon. These Cntl-A sequences
5721   specify how the text following the colon should be attributed. The vile
5722   command "attribute-cntl_a-sequences-til" (bound to ^A-A) may be used to
5723   format a region of text containing these sequences. To continue our
5724   example, the following command will translate this representation of
5725   attributed text into one which is more pleasing to look at.
5726
5727         ^A-AG
5728
5729   Note that macros/manpage.rc also provides a macro that attaches attributes
5730   to any man page displayed in the editor's current buffer.
5731
5732
5733Working in a project hierarchy
5734------------------------------
5735   vile includes several features that enable quick access to many files
5736   spread over a directory hierarchy, as described below.
5737
5738  Directory navigation
5739
5740   vile provides several commands that manipulate an internal directory
5741   stack:
5742
5743         :dirs
5744         :dirs-add   dir
5745         :dirs-clear
5746         :popd       [ {+|-}n ]
5747         :pushd      [ dir | {+|-}n ]
5748
5749   dirs
5750           lists the directory stack in a scratch buffer. Note that the
5751           directory stack is zero-based. Precede this command with an
5752           argument to kill the buffer. "dirs-clear" clears the stack and
5753           kills the scratch buffer. "dirs-add" adds a directory to stack[top
5754           - 1], but does not affect cwd, which makes this command useful for
5755           initializing the stack from a macro or startup file.
5756
5757   popd
5758           removes entries from the directory stack. With no arguments,
5759           removes the top directory from the stack and performs a cd to the
5760           new top directory.
5761
5762                +n
5763                        removes the nth entry counting from stack top.
5764
5765                -n
5766                        removes the nth entry counting from stack bottom.
5767
5768   pushd
5769           adds a directory to the top of the directory stack or rotates the
5770           stack, making the new top of the stack the current working
5771           directory. pushd honors CDPATH, when set. With no arguments, pushd
5772           exchanges the top two directories. Otherwise:
5773
5774                +n
5775                        rotates the stack so that the nth directory, counting
5776                        from stack top, is at the top.
5777
5778                -n
5779                        rotates the stack so that the nth directory, counting
5780                        from stack bottom, is at the top.
5781
5782                dir
5783                        adds dir to the directory stack at the top, making it
5784                        the new current working directory.
5785
5786   If pushd or popd is successful, a "dirs" is performed as well.
5787
5788  Hierarchical tags
5789
5790   Assume the following directory hierarchy:
5791
5792                root
5793               /  |  \
5794              /   |   \
5795            lib  src  include
5796
5797   Assume also that most of the development work takes place in the "src"
5798   directory and that this is a C/C++ project.
5799
5800   Once an appropriate tags file has been created in the src directory (using
5801   the ctags program), vile's tags interface provides quick access to the
5802   most frequently modified project files. But what about the source files in
5803   the "lib" and "include" directories? Is it possible for vile's tags
5804   interface to access the C/C++ files in the aforementioned directories when
5805   the editor's cwd is set as "src"? The answer is an emphatic "Yes". This
5806   can be done using at least two different mechanisms.
5807
5808  Exuberant ctags
5809
5810   Assuming the Exuberant Ctags program is available (written by Darren
5811   Hiebert), the simplest method is as follows:
5812
5813   1) cd to the project root dir and issue this ctags command:
5814
5815     ctags -R . '*.[ch]' '*.cpp'
5816
5817   This command drops out a tags file in the root directory that includes
5818   tags for all three subordinate directories. Repeat this step as necessary
5819   whenever significant changes are occur within the project hierarchy.
5820
5821   2) modify the vile startup file (vile.rc or .vilerc) to include this
5822   setting:
5823
5824     set tagrelative
5825     set tags="../tags"
5826
5827   vile's tags lookup features now provide one-keystroke access to symbols in
5828   _all_ project source files, provided that the editor's current working
5829   directory is set as either src, include, or lib.
5830
5831   It's important to note that Exuberant Ctags has been ported to many hosts
5832   (including VMS) and supports many languages other than C.
5833
5834  Standard ctags
5835
5836   Use this recipe when working with the standard ctags program (available on
5837   virtually all Unix hosts):
5838
5839   1) cd to the project root dir and issue this ctags command:
5840
5841     ctags src/*.[ch] src/*.cpp lib/*.[ch] lib/*.cpp include/*.h
5842
5843   this command drops out a tags file in the root directory that includes
5844   tags for all three subordinate directories. Repeat this step as necessary
5845   whenever the lib or include directory contents change.
5846
5847   2) modify the vile startup file (vile.rc or .vilerc) to include this
5848   setting:
5849
5850     set tagrelative
5851     set tags="../tags"
5852
5853   This method achieves the same one-keystroke symbol access as described for
5854   Exuberant Ctags.
5855
5856  File/Directory traversal (win32/Unix hosts only)
5857
5858   vile's capture-command (bound to ^X-!) includes an interface to the Unix
5859   find command (or equivalent clone) that permits the user to access a large
5860   number of files or directories spread across an arbitrarily complex
5861   hierarchy. This feature requires a small amount of configuration before it
5862   can be used.
5863
5864   To begin with, specify a directory hierarchy via the $findpath state
5865   variable using this syntax:
5866
5867     setv $findpath="<dir>[<delim><dir>]..."
5868
5869   where <delim> is ':' on a Unix host and ';' on a win32 host. If this state
5870   var is not set, "." is assumed.
5871
5872   Next, use find-cfg mode to enable the traversal feature. This mode's
5873   string argument syntax is as follows:
5874
5875     [<recursive_token>][,<nonrecursive_token>[,<option>...]]
5876
5877   where:
5878
5879         <recursive_token> := an ascii character that triggers a
5880                             recursive find.  The selected token may
5881                             not be taken from the character set
5882                             defined by isalpha().  To use ',' as a
5883                             token, escape it with '\'.
5884
5885         <nonrecursive_token> := an ascii character that triggers a
5886                                nonrecursive find-shares the same
5887                                semantic restrictions as the
5888                                recursive token.
5889
5890         <option>          := {d | f}
5891
5892   Note 1: The "d" option specifies that find should restrict its search
5893   solely to files of type "d" (i.e., directories). The "f" option adds a
5894   "-follow" operand to the commandline, which directs find to follow
5895   symbolic links. Note that -follow is appropriate for the GNU tool chain,
5896   SunOS v5.7, and possibly other hosts. Check your local find (1) man page
5897   for compatibility.
5898
5899   Note 2: An empty string argument disables find-cfg mode.
5900
5901   Note 3: Most versions of find do _not_ support nonrecursive operations.
5902   The one known exception is GNU's find.
5903
5904  Examples (file traversal)
5905
5906   Assume the same project hierarchy as was used in the description of
5907   "Hierarchical tags" above. Assume also that the path to the project root
5908   is /local/proj/root and that the vile startup file contains these
5909   settings:
5910
5911     setv $findpath="/local/proj/root"
5912     set find-cfg="$,@"
5913
5914   Then consider this command:
5915
5916     ^X-!$egrep -n FIXME *.[ch] *.cpp
5917
5918   which spawns this Unix shell command:
5919
5920     find /local/proj/root '(' -name '*.[ch]' -o -name '*.cpp' ')' \
5921             -print | egrep -v '((RCS|CVS)/|/[Tt][Aa][Gg][Ss]$)' | \
5922             xargs egrep -n FIXME
5923
5924   and this win32 shell command:
5925
5926     find /local/proj/root '(' -iname '*.[ch]' -o -iname '*.cpp' ')' \
5927             -print | egrep -vi '((RCS|CVS)/|/tags$)' | \
5928             xargs egrep -n FIXME
5929
5930   The net result is that capture-command has been used to find the string
5931   FIXME in all C/C++ source files located in the project hierarchy. The
5932   results of this search are placed in the editor's [Output] buffer. Each
5933   occurrence of the string can be accessed via the error finder's ^X-^X
5934   binding. Note that the above shell commands are crafted to ignore files
5935   stored in RCS/CVS directories and to ignore the files created by ctags.
5936
5937   If it's preferable to use a nonrecursive find operation and the GNU find
5938   utility is available on your host, you might try this on a Unix host:
5939
5940     setv $findpath="/dir1:/dir2:/dir3"
5941     set find-cfg="$,@"
5942     ^X-!@egrep -ni copyright *.txt
5943
5944   which spawns this Unix shell command:
5945
5946     find /dir1 /dir2 /dir3 -maxdepth 1 -name '*.txt' -print | \
5947             egrep -v '((RCS|CVS)/|/[Tt][Aa][Gg][Ss]$)' | \
5948             xargs egrep -ni copyright
5949
5950   Or, correspondingly, on a win32 host:
5951
5952     setv $findpath="/dir1;/dir2;/dir3"
5953     set find-cfg="$,@"
5954     ^X-!@egrep -ni copyright *.txt
5955
5956   which spawns this win32 shell command:
5957
5958     find /dir1 /dir2 /dir3 -maxdepth 1 -iname '*.txt' -print | \
5959             egrep -vi '((RCS|CVS)/|/tags$)' | xargs egrep -ni copyright
5960
5961   Of course, if your version of find doesn't support the "-maxdepth" option,
5962   this feature won't work. The workaround is simple-upgrade to the GNU
5963   version of find.
5964
5965  Examples (directory traversal)
5966
5967   Suppose all you really desire is access to the names of the directories
5968   embedded within a project hierarchy. This might be useful for Perl hackers
5969   who want to manipulate a directory's contents with specialized scripts. To
5970   obtain this functionality, specify find-cfg's "d" option. As a contrived
5971   example:
5972
5973     setv $findpath="/local/proj/root"
5974     set find-cfg="$,@,d"
5975     ^X-!$ls -ld
5976
5977   yields this shell command (on a Unix host):
5978
5979     find /local/proj/root -type d -print | egrep -v '(RCS|CVS)/' | \
5980             xargs ls -ld
5981
5982  File/directory traversal notes
5983
5984     * An astute win32 user will note that the above traversal examples rely
5985       on utilities (find, egrep, and xargs) that aren't available by default
5986       on a win32 host. This problem can be readily remedied by installing
5987       the cygwin emulation package, which includes a large number of fully
5988       functional GNU tools. Cygwin can be obtained from Redhat at
5989       http://www.sourceware.org/cygwin/.
5990     * The most recent file/directory traversal shell command created via
5991       capture-command is stored in the $find-cmd state variable. This can be
5992       a useful debugging aid.
5993     * The $findpath state variable inherits its initial value, if any, from
5994       the VILE_FINDPATH environment variable.
5995
5996
5997Writing your own filters
5998------------------------
5999   Filters may be written as either an external program or with the Perl
6000   interface. Both the manual page filter and the C program colorizer are
6001   examples of external programs which do the filtering. The hgrep.pm perl
6002   script is an example of a filter which uses the vile's interface to Perl.
6003
6004   Regardless, the goal of the filter is to embed in the text a control
6005   sequences which describe how the subsequent text should be attributed by
6006   the vile command
6007
6008         attribute-cntl_a-sequences-til
6009
6010   or, preferably
6011
6012         attribute-from-filter-til
6013
6014   (See above for examples of how to use this command.)
6015
6016   The control sequences take the following form:
6017
6018         ^A<Count><Attr>:
6019
6020   <Count> is a sequence of digits representing the number of characters
6021   following the ':' to be attributed.
6022
6023   <Attr> is a sequence of characters which indicates how to attribute the
6024   required number of characters following the ':'. The following sequences
6025   are recognized by vile:
6026
6027         I               -- italic
6028         B               -- bold
6029         R               -- reverse (or inverse) video
6030         U               -- underline
6031         C<hex digit>     -- color number (one of 16)
6032         H<command>\0     -- hypertext command
6033         M<command>\0     -- meta information (ignored)
6034
6035   The <command> for hypertext commands may be any sequence of characters
6036   except for newlines and null characters. A null character must terminate
6037   the hypertext command. The command should be a valid vile command such as
6038   you might enter into your .vilerc file.
6039
6040   The attribute characters may be used together in any combination. So, for
6041   example, you could use the following to make some text appear both bold
6042   and italic:
6043
6044         ^A15IB:Bold and italic
6045
6046
6047Hypertext
6048---------
6049   Vile does not currently supply a builtin key binding for executing
6050   hypertext commands. The following macro and key binding will cause the
6051   space bar to be bound to a macro which will follow a hypertext link when
6052   the cursor is placed on top of it. If no hypertext link is present, then
6053   the normal default action of advancing one character to the right is
6054   taken:
6055
6056     22 store-macro
6057             ~force execute-hypertext-command
6058             ~if  &not $status
6059             ~force forward-character-to-eol
6060             ~endif
6061     ~endm
6062     bind-key execute-macro-22 ' '
6063
6064   [ TODO: Maybe we should just add a little bit of code to make this the
6065   default binding for space bar? Or is some other key binding preferable? In
6066   any event, it'll only take 7 or 8 lines to do the job... ]
6067
6068   Here is another example, which gives a choice between following a
6069   hyperlink, e.g., as embedded in which-source, or showing its content:
6070
6071     bind-key execute-hypertext-command ^X-z
6072     bind-key show-hypertext-command ^X-Z
6073
6074   When using xvile, double clicking on a hypertext link will cause the
6075   hypertext command to be executed. If no hypertext command is associated
6076   with the text under the cursor, the default action of selecting the word
6077   under the cursor will occur instead.
6078
6079
6080Debugging features
6081------------------
6082   popup-msgs
6083           vile's popup-msgs mode (:se pm) pops up a buffer that displays all
6084           text written to the editor's message line. This mode, when used in
6085           conjunction with the write-message command, provides an effective
6086           mechanism for debugging macros. Type ":se nopm" to disable
6087           popup-msgs.
6088
6089   ~trace/$debug
6090           use vile's builtin macro tracing to see what the macros really do.
6091           The ~trace command sets the $debug variable, which controls
6092           whether vile appends to the [Trace] buffer a copy of each line
6093           executed, the local variables saved/restored and intermediate
6094           states of expression evaluation. To activate tracing, use:
6095
6096             ~trace on
6097
6098           or
6099
6100             setv $debug true
6101
6102           To disable tracing, use:
6103
6104             ~trace off
6105
6106           or
6107
6108             setv $debug false
6109
6110   which-exec <file>
6111           displays the full path that the editor's shell will use to exec
6112           <file>.
6113
6114           Note 1: The list of possible paths is taken from all directories
6115           specified in $PATH + $libdir-path.
6116
6117           Note 2: On non-Unix hosts, a file suffix is required (e.g.,
6118           ":which-exec copy.exe", not "which-exec copy").
6119
6120           Note 3: Specify a numeric argument to force vile to popup a buffer
6121           that displays all possible paths (e.g., "2:which-exec fmt"). For
6122           example:
6123
6124         Show which executable-paths are tested for:
6125                 fmt
6126         ("*" marks found-files)
6127
6128         $PATH
6129                 /usr/local/bin/fmt
6130                 /users/tom/bin/fmt
6131                 /users/tom/com/fmt
6132                 /usr/sbin/fmt
6133                 /sbin/fmt
6134         *       /usr/bin/fmt
6135                 /bin/fmt
6136                 /usr/games/fmt
6137                 ./fmt
6138         $libdir-path
6139                 /usr/lib/vile/fmt
6140
6141   which-source <file>
6142           displays the full path that will be used to source <file>>.
6143
6144           Note 1: The list of possible paths is taken from the same
6145           directory hierarchy described in the "Invocation" help topic.
6146
6147           Note 2: Specify a numeric argument to force vile to popup a buffer
6148           that displays all possible paths (e.g., "2:which-source
6149           vileinit.rc"). For example:
6150
6151         Show which source-paths are tested for:
6152                 vileinit.rc
6153         ("*" marks found-files)
6154
6155         $cwd
6156                 vileinit.rc
6157         $HOME
6158                 /users/tom/vileinit.rc
6159         $startup-path
6160         *       /usr/share/vile/vileinit.rc
6161
6162   For debugging syntax highlighting, the following also are useful:
6163
6164   which-filter <majormode>
6165           Prompt for, and display location of filter program.
6166
6167   which-keywords <majormode>
6168           Prompt for, and display location of keyword files.
6169
6170   HighlightFilterMsg ^X-q
6171           Colors the current buffer if a majormode and filter exist for
6172           same.
6173
6174   HighlightClear ^X-Q
6175           Clears the current buffer's color attributes.
6176
6177
6178X Window System specifics
6179-------------------------
6180   If you are using xvile under X11, the following additions are available:
6181
6182  Mouse Buttons
6183
6184   1 -
6185           Sets cursor position and the start of the selection when mouse
6186           pointer is positioned in any vile window (but not the message
6187           line). Clicking on a mode line will set the keyboard focus to the
6188           corresponding vile window. Double clicking on a mode line will do
6189           the above in addition to clearing the highlighting associated with
6190           the current selection.
6191
6192           Selections may be made by holding button one down and "wiping"
6193           with the mouse. Release of the mouse button will cause the
6194           selection to be yanked and made available (if desired) for
6195           pasting. The region selected may be forced to be rectangular by
6196           holding the control key down while wiping with button one
6197           depressed. If the wiping motion goes out of the current window,
6198           text will be scrolled in the appropriate direction if possible to
6199           accommodate selections larger than the window. The speed at which
6200           the scrolling occurs will increase with the passage of time making
6201           it practical to select large regions of text quickly.
6202
6203           Individual words or lines may be selected by double or triple
6204           clicking.
6205
6206   2 -
6207           Paste the current PRIMARY selection. With a shift modifier, it
6208           pastes at the mouse position, otherwise it pastes at the last text
6209           cursor position before selecting.
6210
6211   3 -
6212           Extend the current selection. As with button one, the selection
6213           may be adjusted or scrolled by holding down button three and
6214           wiping with it. Selections may be extended in any window open to
6215           the same buffer as which the selection was started in.
6216
6217   As described below in the "Scrollbars" section, the buttons are modified
6218   by the control key as follows, when used on a scrollbar:
6219
6220   Ctrl-Button-1 splits the clicked-on window into two windows.
6221   Ctrl-Button-2 deletes the clicked-on window.
6222   Ctrl-Button-3 makes the clicked-on window the only window.
6223
6224   Areas of selected text can be operated on with any vile operator command,
6225   in conjunction with the special "motion" command '^S', which applies the
6226   operator to the selected region. For example, after selecting text with
6227   the mouse, it can be converted to uppercase with ^A-u^S. Remember that
6228   some operators (e.g. the shell-filtering operator, '!') are only capable
6229   of working on full lines of text.
6230
6231  Clipboard
6232
6233   Data may be exchanged between many X applications via the PRIMARY
6234   selection. This selection is set and manipulated as described in the above
6235   section entitled "Mouse Buttons".
6236
6237   Other applications, most notably OpenLook applications, use the CLIPBOARD
6238   selection to exchange data between applications. On many Sun keyboards,
6239   selected text is moved to the clipboard by pressing the "Copy" key and
6240   pasted by pressing the "Paste" key. If you find that you can not paste
6241   text selected in xvile in other applications or vice-versa, it may well be
6242   that these applications use the CLIPBOARD selection instead of the PRIMARY
6243   selection. (The other mechanism used among really old applications
6244   involves the use of a ring of cut buffers.)
6245
6246   xvile provides two commands for manipulating with the clipboard. These are
6247   copy-to-clipboard and paste-from-clipboard. When copy-to-clipboard is
6248   executed, the contents of the current selection are copied to the special
6249   clipboard kill register (denoted by ';' in the register list). When an
6250   application requests the clipboard selection, xvile gives it the contents
6251   of this kill register. The paste-from-clipboard command requests clipboard
6252   data from the current owner of the CLIPBOARD selection.
6253
6254   Users of Sun systems may want to put the following key bindings in their
6255   .vilerc file in order to make use of the Copy and Paste keys found on
6256   their keyboards:
6257
6258     bind-key copy-to-clipboard #-^
6259     bind-key paste-from-clipboard #-*
6260
6261  Scrollbars
6262
6263   The X toolkit version of xvile provides default translations similar to
6264   the translations for scrollbars found in the Athena widget set. (If you
6265   know how to use xterm's scrollbars, you know how to use these scrollbars.)
6266   Button one scrolls forward. Button three scrolls backward. The amount of
6267   scrolling obtained by these buttons depends on the position at which they
6268   were pressed on the scrollbar. Clicking near the top of the scrollbar will
6269   scroll the text by a small amount which may be as little as one line.
6270   Clicking in the middle will scroll by about half a page. Clicking near the
6271   bottom will scroll by a larger amount up to a whole page. Holding either
6272   one of these buttons down will cause repeated scrolling.
6273
6274   If simply pressed and released, button two will set the position in the
6275   buffer to a position proportional to the location of the pointer on the
6276   scroll bar. Button two may be held down to "drag" the slider from one
6277   place to another causing text to scroll continuously.
6278
6279   The Motif and OpenLook versions provide scrollbars from their respective
6280   widget sets. Both versions have a slider indicating the position of the
6281   window over the buffer. OpenLook's slider is fixed in size with little
6282   arrows at the top and bottom of the slider. Pressing on one of these
6283   arrows will cause scrolling in the appropriate direction. The slider may
6284   be "grabbed" and moved by pressing and dragging the middle portion between
6285   the arrows. Motif's slider is solid with size varying to indicate the size
6286   of the window with respect to the size of the buffer. Any portion of it
6287   may be grabbed for movement. There are little arrows at the top and bottom
6288   of the scroll bar which may be clicked upon to cause scrolling by one
6289   line. In both of these widget sets, clicking on the scrollbar either above
6290   or below the slider will cause scrolling by a full page. OpenLook has two
6291   additional control areas; the buffer position may be set to either the
6292   beginning or end of the buffer by pressing on one of the little
6293   rectangular areas at either the top or bottom of the scrollbar.
6294
6295   In all versions built with scrollbars enabled, you can resize windows by
6296   moving the border between corresponding scrollbars (with the mouse). The X
6297   toolkit version is probably the most functional, with the windows being
6298   continuously resized as the mouse is moved. The OpenLook and Motif
6299   versions wait until after a position is selected to resize the windows.
6300   The OpenLook version is perhaps the least functional; there is no visible
6301   indication (other than the position of the mouse pointer) to indicate
6302   where the new border will be.
6303
6304   Splitting and deleting of windows may also be done with the mouse. In each
6305   case the action is selected by pressing one of the mouse buttons over a
6306   scrollbar with the control key held down. Button one (with the control key
6307   held down) will split the scrollbar and the corresponding vile window with
6308   the new border at or near the mouse cursor. Button two (with control key)
6309   will delete the scrollbar and corresponding window. Button three (with
6310   control key) will make the corresponding window the only window.
6311
6312  Standard X command line arguments
6313
6314   +------------------------------------------------------------------------+
6315   | -fn fontname         | Font to use (or -font).                         |
6316   |----------------------+-------------------------------------------------|
6317   | -rv                  | Use reverse video (also -reverse).              |
6318   |----------------------+-------------------------------------------------|
6319   | +rv                  | Don't use reverse video.                        |
6320   |----------------------+-------------------------------------------------|
6321   | -display disp        | Display to run xvile on.                        |
6322   |----------------------+-------------------------------------------------|
6323   | -fg color Foreground | color (or -foreground).                         |
6324   |----------------------+-------------------------------------------------|
6325   | -bg color Background | color (or -background).                         |
6326   |----------------------+-------------------------------------------------|
6327   | -bd color Border     | color (or -bordercolor).                        |
6328   |----------------------+-------------------------------------------------|
6329   | -name name           | Application name used for resource lookups.     |
6330   |----------------------+-------------------------------------------------|
6331   | -title name          | Name to be displayed in titlebar.               |
6332   |----------------------+-------------------------------------------------|
6333   | -geometry geom       | Initial window dimensions in columns and rows.  |
6334   |----------------------+-------------------------------------------------|
6335   | -iconic              | Start xvile iconified.                          |
6336   |----------------------+-------------------------------------------------|
6337   | -xrm Resource        | Specify or change an X resource internal to     |
6338   |                      | xvile.                                          |
6339   +------------------------------------------------------------------------+
6340
6341  Additional xvile command line arguments
6342
6343   +------------------------------------------------------+
6344   | -class name | Class name used for resource lookups.  |
6345   |-------------+----------------------------------------|
6346   | -fork       | to spawn xvile immediately on startup  |
6347   |-------------+----------------------------------------|
6348   | +fork       | to force xvile to not spawn on startup |
6349   |-------------+----------------------------------------|
6350   | -leftbar    | Put scrollbar(s) on left.              |
6351   |-------------+----------------------------------------|
6352   | -rightbar   | Put scrollbar(s) on right (default)    |
6353   +------------------------------------------------------+
6354
6355  Setting a new process group
6356
6357   Some systems and/or some shells and display managers seem to want xvile to
6358   run in its own process group, to help isolate its signals and actions from
6359   the signals and actions of the parent process (i.e. the shell or window
6360   manager that starts xvile). xvile can be forced into its own process group
6361   with the "new-process-group" command, which one would put in the .vilerc
6362   file. Using this will cause a call to "setpgrp()" or "setsid()". This
6363   behavior is not the default because a) it can't be undone, and b) it seems
6364   undesirable on some systems, in that xvile cannot be suspended and put in
6365   the background after startup if it's in its own group.
6366
6367   Additionally, if given a count as argument, this command will cause xvile
6368   to fork(), and the parent to exit before the new process group is set by
6369   the child. This will further isolate it from its process environment (and
6370   in fact will move xvile into the background if started from the shell).
6371
6372   The "new-process-group" command has no effect in non-X11 versions of vile.
6373
6374  X Resources
6375
6376   +------------------------------------------------------------------------+
6377   | Name                     | Description                                 |
6378   |--------------------------+---------------------------------------------|
6379   | font                     | Font to use.                                |
6380   |--------------------------+---------------------------------------------|
6381   | geometry                 | Window dimensions in characters.            |
6382   |--------------------------+---------------------------------------------|
6383   |                          | Name of icon for decorating window frame.   |
6384   | iconName                 | If set, this overrides the compiled-in      |
6385   |                          | pixmap which is used for the window         |
6386   |                          | manager's hint of the icon pixmap.          |
6387   |--------------------------+---------------------------------------------|
6388   |                          | Character classes for multiple click        |
6389   | charClass                | selections. The format is identical to that |
6390   |                          | of xterm(1).                                |
6391   |--------------------------+---------------------------------------------|
6392   | multiClickTime           | How long between clicks (in milliseconds)   |
6393   |                          | to be accepted as a multi-click.            |
6394   |--------------------------+---------------------------------------------|
6395   | foreground               | Foreground/Background color of the main     |
6396   | background               | xvile text area.                            |
6397   |--------------------------+---------------------------------------------|
6398   |                          | Foreground/Background color of the cursor.  |
6399   |                          | By default the cursor location is indicated |
6400   |                          | by inverting the foreground and background  |
6401   |                          | colors of the cell the cursor is over. Thus |
6402   | cursor.foreground        | the color of the cursor will vary depending |
6403   | cursor.background        | upon location. Use of these subresources    |
6404   |                          | will cause the cursor to maintain constant  |
6405   |                          | coloration of the user's choosing, and may  |
6406   |                          | make it easier to see when it appears in a  |
6407   |                          | "highlighted" or "selected" area of text.   |
6408   |--------------------------+---------------------------------------------|
6409   | menuBackground           | (Compile-time optional feature) resources   |
6410   | menuForeground           | for setting the background and foreground   |
6411   |                          | colors of menubar and pulldown menus.       |
6412   |--------------------------+---------------------------------------------|
6413   | modeline.focusForeground | Foreground/Background color of the mode     |
6414   | modeline.focusBackground | line corresponding to the window with       |
6415   |                          | focus, i.e. the "current" window.           |
6416   |--------------------------+---------------------------------------------|
6417   |                          | Foreground/Background color of mode lines   |
6418   | modeline.foreground      | corresponding to windows without the        |
6419   | modeline.background      | keyboard focus. modeline.background is also |
6420   |                          | used for the scrollbar borders and resize   |
6421   |                          | grips.                                      |
6422   |--------------------------+---------------------------------------------|
6423   | forkOnStartup            | If true, xvile forks after initialization.  |
6424   |--------------------------+---------------------------------------------|
6425   |                          | If true, the "current" window is the window |
6426   | focusFollowsMouse        | inhabited by the mouse; no clicking is      |
6427   |                          | necessary to change windows.                |
6428   |--------------------------+---------------------------------------------|
6429   | pointer.foreground       | Foreground/Background color of the pointer. |
6430   | pointer.background       |                                             |
6431   |--------------------------+---------------------------------------------|
6432   | pointer.normalShape      | Set the shapes for the normal and watch     |
6433   | pointer.watchShape       | pointers respectively.                      |
6434   |--------------------------+---------------------------------------------|
6435   |                          | Either true or false; control the placement |
6436   | scrollbarOnLeft          | of the scrollbars. By default, scrollbars   |
6437   |                          | are placed on the right.                    |
6438   |--------------------------+---------------------------------------------|
6439   | scrollbarWidth           | An integer indicating the width of the      |
6440   |                          | scrollbar.                                  |
6441   |--------------------------+---------------------------------------------|
6442   |                          | Foreground/Background color of the slider   |
6443   |                          | or one of the colors of the slider if a     |
6444   | scrollbar.foreground     | stippled pixmap is used. To force the       |
6445   | scrollbar.background     | slider to be only the foreground color, you |
6446   |                          | should set sliderIsSolid to true. (X        |
6447   |                          | toolkit version only)                       |
6448   |--------------------------+---------------------------------------------|
6449   |                          | If false, indicates that the stippled       |
6450   |                          | pixmap should be used to simulate grey.     |
6451   |                          | This will be best on monochrome displays.   |
6452   | scrollbar.sliderIsSolid  | True works better for color displays. True  |
6453   |                          | indicates the slider will be displayed in   |
6454   |                          | the foreground color, shaded to look        |
6455   |                          | three-dimensional, if possible. (X toolkit  |
6456   |                          | version only)                               |
6457   |--------------------------+---------------------------------------------|
6458   |                          | Amount of time in milliseconds to wait      |
6459   | scrollRepeatTimeout      | initially before repeating scroll when      |
6460   |                          | button one or three are held down. (X       |
6461   |                          | toolkit version only).                      |
6462   |--------------------------+---------------------------------------------|
6463   |                          | Amount of time to wait between repeating    |
6464   | scrollRepeatInterval     | subsequent scrolls. This parameter is also  |
6465   |                          | used for controlling the speed at which     |
6466   |                          | selections are scrolled.                    |
6467   |--------------------------+---------------------------------------------|
6468   | selection.foreground     | Foreground/Background color of the          |
6469   | selection.background     | selection regions. "foreground" is the      |
6470   |                          | color that the text is displayed in.        |
6471   |--------------------------+---------------------------------------------|
6472   |                          | If true (the default), highlighting of the  |
6473   |                          | selection will persist even when button one |
6474   |                          | is pressed to set the cursor position. A    |
6475   | persistentSelections     | false value will behave more like other X   |
6476   |                          | applications in which display of the        |
6477   |                          | selection is lost as soon as button one is  |
6478   |                          | pressed.                                    |
6479   |--------------------------+---------------------------------------------|
6480   |                          | If false (the default), the cursor will be  |
6481   |                          | restored to its previous position prior to  |
6482   |                          | making the selection. If true, the cursor   |
6483   | selectionSetsDOT         | will be positioned at the location of the   |
6484   |                          | mouse at the end of making a selection      |
6485   |                          | (usually at either the start or end of a    |
6486   |                          | selection).                                 |
6487   |--------------------------+---------------------------------------------|
6488   |                          | An integer indicating the time in           |
6489   |                          | milliseconds to wait before blinking the    |
6490   |                          | cursor. A positive value will cause the     |
6491   |                          | cursor to always blink. Setting             |
6492   |                          | blinkInterval to zero will cause the cursor |
6493   |                          | to never blink which may be useful on some  |
6494   |                          | display servers connected to very slow      |
6495   | blinkInterval            | networks. The disadvantage of setting it to |
6496   |                          | zero is that it is sometimes hard to tell   |
6497   |                          | where the cursor is when situated at the    |
6498   |                          | boundary of a highlighted region. A         |
6499   |                          | negative value (which is the default) will  |
6500   |                          | cause the cursor to blink only when         |
6501   |                          | situated in a highlighted region such as a  |
6502   |                          | selection. This will make the cursor        |
6503   |                          | visible no matter where it is.              |
6504   |--------------------------+---------------------------------------------|
6505   |                          | When doing text attribution with the        |
6506   |                          | "attribute-cntl_a-sequences-til" command    |
6507   |                          | (bound to ^A-A), the attribute may be of    |
6508   |                          | the form "Cn", where 'n' is a hexadecimal   |
6509   |                          | digit. This digit picks one of the 16       |
6510   |                          | fcolor/bcolor pairs set up in the color     |
6511   |                          | subresource. For example, if the buffer     |
6512   |                          | contained the text: ^A6C3:foobar then after |
6513   |                          | the ^A-A command was applied, the leading   |
6514   | color.fcolor0,           | "^A3C3:" would be gone, and the word        |
6515   | color.bcolor0, ...,      | "foobar" would appear in the foreground and |
6516   | color.fcolor15,          | background colors specified by              |
6517   | color.bcolor15           | color.fcolor3 and color.bcolor3. The        |
6518   |                          | fcolorN resources have default values       |
6519   |                          | corresponding to the ANSI convention, while |
6520   |                          | bcolorN default to the window background.   |
6521   |                          | If you wish to set bcolorN for special      |
6522   |                          | effect, you should add this to your .vilerc |
6523   |                          | file set bcolor=fcolor to tell xvile to use |
6524   |                          | the bcolorN resources when displaying       |
6525   |                          | attributed text. Otherwise, setting bcolor  |
6526   |                          | will change the window background, as in    |
6527   |                          | the termcap and similar versions of vile.   |
6528   |--------------------------+---------------------------------------------|
6529   | menuHeader               | The names given to the menu header and      |
6530   | menuEntry                | entries, respectively.                      |
6531   |--------------------------+---------------------------------------------|
6532   | menuHeight               | resource controlling the Athena menu-height |
6533   |--------------------------+---------------------------------------------|
6534   | openIm                   | true if input method should be opened       |
6535   |                          | (default: true)                             |
6536   |--------------------------+---------------------------------------------|
6537   | inputMethod              | input method to use (default: "")           |
6538   |--------------------------+---------------------------------------------|
6539   | preeditType              | pre-edit type (default: "OverTheSpot,Root") |
6540   |--------------------------+---------------------------------------------|
6541   | wheelScrollAmount        | Amount to scroll for a wheel mouse, per     |
6542   |                          | button-press.                               |
6543   +------------------------------------------------------------------------+
6544
6545  Sample .Xdefault entries
6546
6547   You may or may not want to use the following as a starting point for the
6548   "XVile" section of your .Xdefaults or .Xresources file. If you have a
6549   monochrome display server, you will probably not want to use any of the
6550   color specifications. You may, however, wish to set up a blinking cursor,
6551   using "blinkInterval" (see above).
6552
6553     XVile*font: -*-courier-medium-r-normal-*-*-*-75-75-m-70-iso8859-*
6554     XVile*geometry: 80x54
6555     XVile.background: darkslategrey
6556     XVile.foreground: honeydew
6557     XVile.scrollbar.foreground: firebrick2
6558     XVile.scrollbar.sliderIsSolid: true
6559     XVile.selection.background: aquamarine4
6560     XVile.selection.foreground: honeydew
6561     XVile.cursor.background: yellow
6562     XVile.cursor.foreground: darkslategrey
6563     XVile.modeline.Background: steelblue
6564     XVile.modeline.foreground: darkslategrey
6565     XVile.modeline.focusForeground: yellow
6566
6567  X11 Fonts
6568
6569   The $font variable corresponds to the X11 font resource. To change the
6570   font on the fly, use the ':setv' command to set the $font variable, with
6571   ":setv $font <fontname>". The actual font used depends upon how xvile is
6572   built:
6573
6574     * If xvile uses bitmap fonts, fontname is either an XLFD string which is
6575       a dash-separated list of attributes, or an alias to one of the known
6576       X11 fonts.
6577
6578       xvile derives the names of bold and italic fonts from the fontname
6579       string by changing those attributes. The fontsize is one of those
6580       attributes, but is less readily changed (bitmap fonts cannot be scaled
6581       nicely).
6582
6583       Users of xvile will find that the italic font in particular is not
6584       always available with the font that they've chosen (or have had chosen
6585       for them). If an italic font is unavailable, xvile will underline text
6586       which is meant to be italic. The program xfontsel is quite useful for
6587       determining which fonts are available on your display server and
6588       whether there are corresponding bold and/or italic fonts available.
6589
6590     * If xvile uses TrueType fonts, the fontsize can be given as the second
6591       field in a comma-separated list, e.g., ":setv $font monospace,18". To
6592       change only the size, omit the font family name, e.g., ":setf $font
6593       ,22".
6594
6595       In this case, xvile uses the Xft and fontconfig libraries to derive
6596       bold and italic fonts.
6597
6598   Here are some tips on using xfontsel to find an appropriate font.
6599
6600    1. Set rgstry (registry) to iso8859
6601    2. Set spc (spacing) to either "c" (cell font) or "m" (monospaced font).
6602       You will be more likely to find a font which will work as italic if
6603       you choose a monospaced font, however. You definitely do not want a
6604       proportional font.
6605    3. Now pull down the slant menu. Select either "i" (italic) or "o"
6606       (oblique). If neither of these are available, go back to step 2 and
6607       choose a different spacing.
6608    4. Set avgWdth (average width) next. If you divide the value you've
6609       chosen by ten, this will be width of a glyph in the font in pixels.
6610    5. Set wght (weight) to medium. If you have a hard time seeing the
6611       characters, you might want to choose bold, but xvile will not be able
6612       to use the bold font for displaying bold text. It will be forced to
6613       overwrite text that it wants to be bold with the text shifted by one
6614       pixel. This works fairly well for larger fonts.
6615    6. Set fmly (family) to a value according to personal taste. By this
6616       step, you might not have any choice on the matter anyway.
6617    7. If only one font is available at this point, the other fields don't
6618       matter that much. Otherwise set these according to taste.
6619    8. Go back to the slant menu and change either the "i" or "o" to "r".
6620
6621   This will be the font to use. xvile will be attempt to get the italic font
6622   when needed by substituting either "o" or "i" for the "r".
6623
6624   If the above seems too tedious, you can just try the following font which
6625   (on many display servers) is pretty close to the size of the default font
6626   that xvile will start up with.
6627
6628     -*-courier-medium-r-*-*-*-*-*-*-*-70-*-*
6629
6630   You can try it out by issuing the appropriate "set font" command from
6631   xvile. For longer term use, you will probably want to put it in your
6632   .Xdefaults file. It will look something like this:
6633
6634     XVile*font: -*-courier-medium-r-*-*-*-*-*-*-*-70-*-*
6635
6636   You may also set the font from your .vilerc file. This is not recommended,
6637   however, as you lose the ability to choose a different font from the
6638   command line or resource file. It may also cause the xvile window to be
6639   unnecessarily resized during initialization.
6640
6641
6642DOS specifics
6643-------------
6644   The .vilerc file is called vile.rc under DOS.
6645
6646   vile is perfectly happy (and even tries very hard) to use the UNIX-style
6647   "forward-slash" ('/') as a path delimiter. Entering the "backslash" ('\')
6648   will work, but you should be aware that vile uses this character as an
6649   escape mechanism for entering special characters (e.g. "\t" for TAB) in
6650   strings. As an example setting "tags" to "tags ..\tags" will not have the
6651   intended result. Instead, use "tags ..\\tags" or better, "tags ../tags".
6652
6653   vile should leave your screen in the mode you're in when you enter it,
6654   unless you explicitly change it to a different mode with a "set sres="
6655   line in your vile.rc, or if you use a command line option to change it.
6656   Command line options consist of a dash followed by one of the following
6657   selectors (these are the same values that can be assigned to "sres").
6658   These values are supported by the DOS (borland.c) terminal driver: "2",
6659   "25", "4", "43", "5", "50", "6", "60"
6660
6661   If you shell out in 50 line mode, make sure you are in 50 line mode before
6662   you exit the dos shell, otherwise you end up with a 50 line edit window
6663   with only the top 25 displayed.
6664
6665   The vile.rc file can be located in the same directory as your binary
6666   executable, since vile searches the $PATH for this file.
6667
6668   All file globbing, including from the command line, is done using UNIX
6669   shell-style wild-carding conventions.
6670
6671   The expansion of the ':' character in user input, which normally expands
6672   to the "word under the cursor", is suppressed for DOS, due to the conflict
6673   with the drive-specifier syntax (e.g. "c:\foo"). The character '&' may be
6674   used for this instead.
6675
6676   In any version of vile there is a command, "set-dos-mode", which will a)
6677   strip all carriage-return ('^M') characters from the ends of lines in the
6678   buffer and b) set the "dos" mode so that carriage returns are appended
6679   when the file is written. There is also a corresponding "set-unix-mode"
6680   command, which strips carriage returns, and forces "nodos" mode, so that
6681   they don't come back when you write the file. In both cases, "dos" mode
6682   becomes a so-called "local" mode, so that the rest of your buffers will be
6683   unaffected. See also the discussion of "recordseparator" mode.
6684
6685
6686VMS specifics
6687-------------
6688   The .vilerc file is called vile.rc under VMS
6689
6690   Reading from a pipe works; writing to a pipe is not implemented.
6691
6692   As is true for DOS, the expansion of the ':' character in user input is
6693   not supported due to conflicts with filename syntax delimiters. Use '&'
6694   instead.
6695
6696  Paths
6697
6698   vile recognizes either VMS- or UNIX-style pathnames and '~' is supported
6699   as a shortcut for SYS$LOGIN (e.g., :e ~/login.com). However, filename
6700   completion only works for UNIX-style pathnames, since those allow us to
6701   implement directory and filenames in the same syntax.
6702
6703   CDPATH directory lists are delimited with a comma and only the following
6704   components may be included:
6705
6706     * rooted logicals terminated with ':'
6707     * directories terminated with ']'
6708
6709   Example:
6710
6711         $ CDPATH :== dev$diska:[home],rooted$build_dir:
6712
6713  Command-Line Switches
6714
6715   vile accepts these command-line options in addition to the standard ones:
6716
6717   +---------------------------------------------------------+
6718   | Option | Description                                    |
6719   |--------+------------------------------------------------|
6720   | -80    | force 80-column mode (N/A for VT52 terminals)  |
6721   |--------+------------------------------------------------|
6722   | -132   | force 132-column mode (N/A for VT52 terminals) |
6723   +---------------------------------------------------------+
6724
6725  Modes
6726
6727   +------------------------------------------------------------------------+
6728   | Name          | Description                                            |
6729   |---------------+--------------------------------------------------------|
6730   |               | Show all versions of files in response to filename     |
6731   | allversions   | completion or wildcards on the command line. Normally  |
6732   |               | this is off. (U)                                       |
6733   |---------------+--------------------------------------------------------|
6734   |               | This feature is implemented by setting the screen      |
6735   | flash         | video to reverse color and then normal. If this        |
6736   |               | sequence of changes is incompatible with your terminal |
6737   |               | preferences, avoid this mode and use vtflash instead.  |
6738   |---------------+--------------------------------------------------------|
6739   |               | Specify format of files that vile writes. If           |
6740   | record-format | undefined, vile will attempt to use the format of an   |
6741   |               | older version of the file, or "stmlf" if none exists.  |
6742   |               | (B)                                                    |
6743   |---------------+--------------------------------------------------------|
6744   |               | Specify record attributes of files that vile writes.   |
6745   | record-attrs  | If undefined, vile will attempt to use the format of   |
6746   |               | an older version of the file, or "cr" if none exists.  |
6747   |               | (B)                                                    |
6748   |---------------+--------------------------------------------------------|
6749   | record-length | Maximum record size, used if record-format is "fixed"  |
6750   |               | or "vfc". (B)                                          |
6751   +------------------------------------------------------------------------+
6752
6753  Variables
6754
6755   +------------------------------------------------------------------------+
6756   | Name  | Description                                                    |
6757   |-------+----------------------------------------------------------------|
6758   |       | Switch between 80- and 132-column screen resolutions by        |
6759   | $sres | setting this variable to either NORMAL or WIDE (e.g., :setv    |
6760   |       | $sres=wide).                                                   |
6761   +------------------------------------------------------------------------+
6762
6763  Default key maps
6764
6765   With respect to VT100 and later terminal types, the editor assumes a vt220
6766   keyboard and maps special keys to their closest vile counterpart (e.g.,
6767   "Remove" mapped to vile's "Delete"). Some vt220 keyboard special keys have
6768   no obvious counterpart, in which case, these mappings apply:
6769
6770         PF1-PF4  =>  F1-F4,
6771         Help     =>  F15,
6772         DO       =>  F16.
6773
6774
6775Win32 specifics
6776---------------
6777   The editor may be invoked/built as a console or GUI application. The
6778   former is known as vile.exe and the latter as winvile.exe . For the
6779   remainder of this section of the help file, a generic reference to "vile"
6780   refers to both the console and GUI editor, unless otherwise stated.
6781
6782  Heritage
6783
6784   The Win32 version of vile supports almost all of the features and changes
6785   listed directly above in the section entitled "DOS specifics", with the
6786   exception that the editor's screen resolution cannot be changed using
6787   explicit -43, -50, etc. command-line switches or via the sres command.
6788
6789  GUI Command-Line Switches
6790
6791   Winvile accepts these command-line options in addition to the standard
6792   ones:
6793
6794   +------------------------------------------------------------------------+
6795   | Name              | Description                                        |
6796   |-------------------+----------------------------------------------------|
6797   | -fn <fontspec>    | Initial font (or -font). The "Winvile Font"        |
6798   |                   | section below describes <fontspec> syntax.         |
6799   |-------------------+----------------------------------------------------|
6800   |                   | Initial window dimensions in Columns and Rows (for |
6801   |                   | example "-geometry 80x30"). Be aware that the      |
6802   | -geometry <C>x<R> | specified geometry may not exceed the bounds of    |
6803   |                   | the current desktop screen. Note also that         |
6804   |                   | $pagelen and $pagewid may be used to change        |
6805   |                   | winvile's dimensions.                              |
6806   |-------------------+----------------------------------------------------|
6807   |                   | Check if the remainder of the command-line (after  |
6808   |                   | this option) is a readable filename which may      |
6809   | -i                | contain embedded blanks. If so, change current     |
6810   |                   | directory to match this filename. This is used to  |
6811   |                   | make shortcuts such as "Send To" work nicely.      |
6812   +------------------------------------------------------------------------+
6813
6814  Console Command-Line Switches
6815
6816   Vile accepts these additional command-line options:
6817
6818   +------------------------------------------------------------------------+
6819   | Name     | Description                                                 |
6820   |----------+-------------------------------------------------------------|
6821   |          | Start editor in a new console environment if stdin is       |
6822   |          | redirected (i.e., input is taken from a redirected file or  |
6823   | -console | from a pipe). If this option is not set when stdin is       |
6824   |          | redirected, console mouse features are unavailable (this    |
6825   |          | problem is most often encountered on a Windows NT host).    |
6826   +------------------------------------------------------------------------+
6827
6828  Pipes
6829
6830   Internally, vile uses two radically different mechanisms for piping data
6831   to and from the shell. One mechanism uses temporary files and the other
6832   simply calls native Win32 services. This dichotomy exists because the NT
6833   shell (cmd.exe) handles native pipes cleanly, but command.com, Microsoft's
6834   16-bit Win9X/WinME shell, does not. The mode variable w32pipes determines
6835   which mechanism is used.
6836
6837   On WinNT/Win2K hosts, w32pipes is set by default and vile's pipe
6838   operations are implemented via Win32 services. On Win9X/WinME hosts, this
6839   mode is disabled by default and the editor falls back to temp files. Take
6840   note that 32-bit shells (e.g., Cygwin's bash, MKS's shell) properly handle
6841   native pipe operations on Win9X/WinME hosts. In that context, it's
6842   appropriate and highly desirable to manually enable "w32pipes" (e.g., "se
6843   w32pipes").
6844
6845   +------------------------------------------------------------------------+
6846   | ******** Warning *********                                             |
6847   |------------------------------------------------------------------------|
6848   | If w32pipes is enabled and command.com initiates a pipe I/O            |
6849   | transaction on behalf of the editor, vile will almost certainly hang.  |
6850   | See the "Shell" topic below to learn how to specify the editor's       |
6851   | default shell.                                                         |
6852   +------------------------------------------------------------------------+
6853
6854  Paths
6855
6856   vile recognizes either DOS- or UNIX-style pathnames and '~' is supported
6857   as a shortcut for $HOME (e.g., :e ~/vile.rc).
6858
6859   CDPATH directory lists are delimited with a semicolon.
6860
6861  Shell
6862
6863   When a filter, pipe, or explicit shell command requires execution of an
6864   external process, vile invokes an instance of the shell specified in the
6865   $COMSPEC environment variable. This default may be overridden by setting
6866   $shell from within vile.rc . Example:
6867
6868     set-variable $shell 'c:\usr\binw\sh.exe'
6869
6870   As is true on other hosts, external processes are normally started under
6871   the control of a shell. To forego the shell entirely, prefix the command
6872   string with "start ". Example:
6873
6874     :!start calc           # start the windows calculator
6875
6876   Finally, it may be necessary to pass one or more flags to the shell
6877   invoked via the :sh command (e.g., force execution of a special login
6878   script). Passing such flag(s) via $shell is not a workable solution.
6879   Instead, use a macro similar to the following that supersedes the builtin
6880   :sh command:
6881
6882     store-procedure sh
6883             ; pass -L (login) flag to MKS shell, assumes sh is
6884             ; reachable from $PATH
6885             ~local %sh
6886             setv %sh="sh -L"
6887             ~if &seq $progname "winvile"
6888                     1 shell-command &cat "start " %sh
6889             ~else
6890                     1 shell-command %sh
6891             ~endif
6892     ~endm
6893
6894   In the example, the "1" preceding "shell-command" tells winvile to
6895   suppress the
6896
6897     press any key to continue
6898
6899   prompt which it would normally use when the command completes. Without the
6900   prompt, the console window which winvile opens to run a shell command will
6901   close by itself.
6902
6903  Cygwin's Bash Versus Console vile
6904
6905   Using Cygwin's bash as vile's shell works well, with one exception. When
6906   console vile is invoked from a bash command line, typing ^C or
6907   Control+Break within the editor causes an immediate exit (no data saved).
6908   As it turns out, bash's signal handling is crafted to work best with other
6909   Cygwin programs (ls, wc, etc.) and not with native Win32 apps. A simple
6910   workaround is as follows:
6911
6912    1. obtain and install the ash shell, which is included with the Cygwin
6913       distribution. Note that ash is installed as sh.exe .
6914    2. edit .bashrc (or equivalent config file) and add this function:
6915
6916          function vile
6917          {
6918                   sh <<- ENDIT-
6919                   vile $@
6920          ENDIT
6921          }
6922
6923       When console vile is subsequently invoked from a bash command line,
6924       the editor will be started by sh, which does not suffer from the
6925       problem described above. The only drawback with this solution is that
6926       $@ splits filenames containing embedded spaces.
6927
6928  Mouse (GUI and Console)
6929
6930   Selecting and dragging with the left mouse button yanks text to the
6931   unnamed register. Press a control key during the selection to sweep out a
6932   rectangular region. Paste the selected text using the second (middle)
6933   mouse button. Clear a selection by clicking on a modeline.
6934
6935   Resize a window by dragging its modeline up/down.
6936
6937   Change vile's window focus via left mouse button clicks (when multiple
6938   windows are displayed).
6939
6940   Select individual words or lines with a double or triple click.
6941
6942   Note that console vile has zero mouse functionality if the parent command
6943   prompt window (aka DOS box) is configured with QuickEdit Mode enabled.
6944   QuickEdit is accessed like so:
6945
6946         system menu->Properties->Options Tab
6947
6948  Winvile Mouse
6949
6950   Pressing the right mouse button pops up a menu of editor commands. These
6951   are predefined:
6952
6953   +------------------------------------------------------------------------+
6954   | Menu entry | Description                                               |
6955   |------------+-----------------------------------------------------------|
6956   | Open       | executes the "winopen" command (described below).         |
6957   |------------+-----------------------------------------------------------|
6958   | Save As    | executes the "winsave" command (described below).         |
6959   |------------+-----------------------------------------------------------|
6960   | CD         | executes the "wincd" command (described below).           |
6961   |------------+-----------------------------------------------------------|
6962   |            | executes "winopen $favorites", which starts a common open |
6963   |            | dialog box that browses the Windows Favorites folder.     |
6964   |            | This feature is especially useful when folder shortcuts   |
6965   | Favorites  | are added to the Favorites folder via the Windows         |
6966   |            | Explorer's "Add To Favorites" feature. Once folder        |
6967   |            | shortcut(s) have been created in this manner, winvile's   |
6968   |            | "Favorites" menu provides two-click access to the         |
6969   |            | contents of any local or network-based folder.            |
6970   |------------+-----------------------------------------------------------|
6971   | Font       | described below.                                          |
6972   |------------+-----------------------------------------------------------|
6973   |            | disables the popup menu and instead transforms the right  |
6974   |            | mouse button into a hot key that copies the contents of   |
6975   | Menu       | the unnamed register to the clipboard. When the popup     |
6976   |            | menu is disabled, selection with the left mouse, followed |
6977   |            | by a right mouse click, provides a quick means of copying |
6978   |            | highlighted blocks of text to the clipboard.              |
6979   |------------+-----------------------------------------------------------|
6980   | Undo       | Bound to undo-changes-backward.                           |
6981   |------------+-----------------------------------------------------------|
6982   | Redo       | Bound to redo-changes-forward.                            |
6983   |------------+-----------------------------------------------------------|
6984   | Cut        | deletes current text selection into unnamed register and  |
6985   |            | copies same to clipboard.                                 |
6986   |------------+-----------------------------------------------------------|
6987   | Copy       | copies the current text selection to both the unnamed     |
6988   |            | register and the clipboard.                               |
6989   |------------+-----------------------------------------------------------|
6990   | Paste      | pastes clipboard contents (if text) into current buffer.  |
6991   |------------+-----------------------------------------------------------|
6992   | Delete     | deletes current text selection into unnamed register.     |
6993   |------------+-----------------------------------------------------------|
6994   | Select All | selects all text in the current buffer.                   |
6995   +------------------------------------------------------------------------+
6996
6997   The first six popup menu entries are added to the system menu (in the
6998   upper left corner of the window). The system menu also includes:
6999
7000     * two selections that support the traditional Windows printing
7001       interface.
7002     * a "Recent Files" menu that lists the last N files opened/created by
7003       the editor. Any file selected from this list is immediately opened for
7004       editing. This feature is disabled by default, but can be configured
7005       via the "recent-files" mode.
7006     * a "Recent Folders" menu that lists the last N folders visited via an
7007       explicit or implicit cd. Selecting a folder from this list is
7008       equivalent to executing ":cd <foldername>". This feature is disabled
7009       by default, but can be configured via the "recent-folders" mode.
7010     * a "Menu" command that disables/re-enables the aforementioned popup
7011       menu.
7012
7013  Clipboard
7014
7015   There are several ways to copy to/from the clipboard:
7016
7017     * Copy data from the unnamed register to the windows clipboard via the
7018       copy-unnamed-reg-to-clipboard command (bound to Alt+Insert).
7019     * Copy data from a named register or region to the clipboard (a la
7020       vile's ^W operator) via the copy-to-clipboard-til command (bound to
7021       Ctrl+Insert).
7022     * The paste-from-clipboard command copies data from the clipboard to the
7023       current buffer (bound to Shift+Insert).
7024     * Finally, the cut-to-clipboard command deletes the current text
7025       selection and copies same to both the clipboard and the unnamed
7026       register (bound to Shift+Delete).
7027
7028   Some examples, assuming <CI> => Ctrl+Insert and <AI> => Alt+Insert:
7029
7030         4yy<AI>  ;copy 4 lines from unnamed reg to clipboard
7031         "a<CI>   ;copy register 'a' to clipboard
7032         "b<CI>   ;copy register 'b' to clipboard
7033         <CI>3w   ;copy 3 words to clipboard
7034
7035   The swap-clipboard-keys command swaps the commands bound to Ctrl+Insert
7036   and Alt+Insert.
7037
7038  OLE Automation
7039
7040   Winvile may be invoked as an OLE automation server and thereafter
7041   controlled by an OLE client. Refer to the file doc/oleauto.doc for further
7042   details. Additionally, the OLE client "visvile.dll" provides a mechanism
7043   for substituting winvile as the default Developer Studio editor. Refer to
7044   the file doc/visvile.doc for detailed information.
7045
7046  Winvile Font
7047
7048   Winvile's font may be set via a command-line switch or from within the
7049   editor by modifying the built-in $font state variable. In either case, a
7050   <fontspec> string describes the desired font, where:
7051
7052         <fontspec>  :== [<face>,]<size>[,<style>]
7053         <face>      :== font-name
7054         <size>      :== point size (as an integer)
7055         <style>     :== { bold | italic | bold-italic }
7056
7057   Note 1: if <style> is unspecified, "normal" is assumed.
7058
7059   Note 2: if <face> contains a comma, escape it with '\'.
7060
7061   Note 3: if <face> is omitted, the current font is modified.
7062
7063   Note 4: if <face> contains spaces and the font is set from the
7064   command-line, delimit <fontspec> as appropriate for the current
7065   shell/desktop environment.
7066
7067   Note 5: <face> must be fixed pitch. To obtain a list of all fixed pitch
7068   fonts on the current win32 host, invoke winvile and browse the "Font"
7069   dialog box accessible from the system menu (accelerator key is ALT+<space
7070   bar>+f).
7071
7072         Cmdline Examples                Internal Examples
7073         ****************                *****************
7074         -fn 'Letter Gothic,8'           :setv $font r_ansi,7
7075         -font r_ansi,8,bold             :setv $font 8
7076
7077         Vile.rc Example
7078         ***************
7079
7080     ~if &sequal $progname "winvile"
7081             set-variable $font "courier new,8"
7082     ~endif
7083
7084  Winvile registry settings
7085
7086   Winvile uses the system registry to store persistent user settings. If you
7087   have specified that it is installed for all users, then the installer
7088   creates the key VI Like Emacs under
7089
7090     HKEY_LOCAL_MACHINE\Software
7091
7092   otherwise, under
7093
7094     HKEY_CURRENT_USER\Software
7095
7096   In either case, winvile looks for information from these keys under its VI
7097   Like Emacs key:
7098
7099     * Environment
7100     * MRUFiles
7101     * MRUFolders
7102
7103   Data under MRUFiles and MRUFolders is maintained by winvile when the
7104   corresponding mode recent-files or recent-folders is enabled by setting it
7105   to a nonzero value.
7106
7107   winvile looks for environment variables by first using the standard
7108   getenv, and if that returns nothing, checks its analogous Environment key
7109   in the registry. winvile uses the registry in this way because it is
7110   unreliable for installers to set environment variables directly on
7111   Windows.
7112
7113   These environment variables may be initialized by the winvile installers:
7114
7115     * VILE_HELP_FILE
7116     * VILE_LIBDIR_PATH
7117     * VILE_STARTUP_FILE
7118     * VILE_STARTUP_PATH
7119
7120   These environment variables are also useful in winvile:
7121
7122     * VILEINIT
7123     * VILE_ERROR_ABORT
7124
7125  Winvile Commands
7126
7127   delete-text-selection
7128           Delete the current text selection to the unnamed register. Bound
7129           to Alt+Delete.
7130
7131   purge-recent-files
7132           Clear the list of files that appear in winvile's "Recent Files"
7133           menu.
7134
7135   purge-recent-folders
7136           Clear the list of folders that appear in winvile's "Recent
7137           Folders" menu.
7138
7139   reset-rgb-palette
7140           Set red/green/blue values to their initial state. If you give a
7141           parameter, this is used to specify a single color number.
7142
7143   set-rgb-palette
7144           Set red/green/blue values for the specified color. Values range
7145           from 0-255. Example:
7146
7147         set-rgb-palette red 200 0 0
7148
7149   swap-clipboard-keys
7150           See discussion of clipboard above.
7151
7152   wincd [dir]
7153           Launches a standard Windows "Browse Folder" control for the
7154           purpose of graphically specifying a new working directory. The
7155           optional "dir" argument specifies the initial browse directory
7156           (default is current working directory).
7157
7158   winopen [dir]
7159           Launches the Windows common open dialog box to open one or more
7160           files within the editor. The optional "dir" argument specifies the
7161           initial browse directory (default is current working directory).
7162           Note that if this dialog box opens files outside the editor's cwd,
7163           then Windows (and vile) implicitly change the cwd to match that of
7164           the opened files. This command _is_ available from console vile.
7165
7166   winopen-nocd [dir]
7167           Same as "winopen", except the editor's cwd remains unchanged.
7168
7169   winpage-setup
7170           launch Windows common page setup dialog (winvile only). Use this
7171           command to set page attributes before invoking winprint.
7172
7173   winprint
7174           print current buffer or text selection (winvile only). Note that
7175           neither color nor display attributes are rendered at this time.
7176
7177   winsave [dir]
7178           Launches the Windows common save dialog box to save the current
7179           buffer in a file of the user's choice. The optional "dir" argument
7180           specifies the initial browse directory (default is cwd). Note that
7181           if this dialog box saves a file outside the editor's cwd, then
7182           Windows (and vile) implicitly change the cwd to match that of the
7183           saved file. This command _is_ available from console vile.
7184
7185   winsave-nocd [dir]
7186           Same as "winsave", except the editor's cwd remains unchanged.
7187
7188  Modes
7189
7190   echo-to-clipboard
7191           all text selected with the mouse is automatically copied to the
7192           Windows clipboard. (U)
7193
7194   icursor
7195           denotes a string that configures the characteristics of an
7196           insertion cursor.
7197
7198           With respect to console vile, this string either specifies a
7199           fixed, block cursor height or else sets the block cursor heights
7200           in the editor's insertion and command modes. Argument syntax:
7201
7202           "<fixed_block_height>" or "<insmode_height>,<cmdmode_height>"
7203
7204           The valid range of <fixed_block_cursor_height> is 0-100 (%).
7205           Specifying 0 reverts to the cursor height in effect at editor
7206           invocation. The valid range of <insmode_height> and
7207           <cmdmode_height> is 1-100.
7208
7209           With respect to winvile, this string specifies an integer in the
7210           range 0-2, which selects one of the following styles:
7211
7212         0 -> fixed block cursor
7213         1 -> cmd mode = block cursor
7214             ins mode = vertical bar
7215         2 -> cmd mode = vertical bar
7216             ins mode = block cursor (U)
7217
7218   popup-menu
7219           Enables/disables the winvile popup menu. (U)
7220
7221   recent-files
7222           Specify maximum number of files that may appear in winvile's
7223           "Recent Files" menu. Range is 0-20; a value of 0 disables this
7224           menu. (U)
7225
7226   recent-folders
7227           Specify maximum number of folders that may appear in winvile's
7228           "Recent Folders" menu. Range is 0-20; a value of 0 disables this
7229           menu. (U)
7230
7231   scroll-pause
7232           An integer indicating the time in milliseconds to wait after
7233           scrolling the display. A value of zero, the default, disables this
7234           mode. This mode is necessary when rapid scrolling operations cause
7235           improper screen refresh by the console editor (should only be a
7236           problem with inexpensive video HW). Typical values, if required,
7237           are 20-80 (msec). (U)
7238
7239   w32pipes
7240           See discussion of pipes above. (U)
7241
7242  Configuring both editors
7243
7244   Some vile commands and modes apply only to winvile and some only to
7245   console vile. If you plan to run both winvile and console vile in the
7246   context of a single startup file, you'll need to include code similar to
7247   this in vile.rc:
7248
7249       ~if &sequal $progname "winvile"
7250               set-variable $font "r_ansi,8"
7251               setv $pagelen=39
7252               set icursor="1"
7253               ; etc
7254       ~else
7255               set icursor="35,100"
7256               ; etc
7257       ~endif
7258
7259
7260Differences from vi
7261-------------------
7262   Of course, this really isn't vi. Some of the following differences deserve
7263   changing, others do not.
7264
7265   The parser for the ':' commands is not very vi-like. For instance, ":e"
7266   will prompt you for a file name. Most commands remember their last
7267   argument, and will present it as the default reply to their prompt.
7268
7269   The backspace, line kill, word kill, job control, etc. characters are not
7270   rebindable. They are, however, read from the tty settings on startup.
7271
7272   There is no expansion of ! in filenames. It is expanded in shell escapes,
7273   so the command ":!!" does rerun the previous shell command. Occurrences of
7274   '#' and '%' are recognized and expanded to the previous or current
7275   filename.
7276
7277   Paragraph and section boundaries, for the {, }, [, and ] commands are
7278   configurable, but may not exactly match those in vi. They are expressed
7279   via regular expressions. The default regular expressions are quite
7280   complex, to support the traditional nroff and troff boundaries. If you are
7281   just editing code, you may want to replace them:
7282
7283       ; set paragraph and section r.e.s for speed on C/C++/perl code.
7284       set paragraphs=^$
7285       set sections=^[{^L]
7286
7287   There is no special lisp support. But then, when was the last time you
7288   heard of a lisp programmer that used vi?
7289
7290   Of course, ex and open mode aren't there. (Too bad. I'd love to have a
7291   companion editor called "exile".)
7292
7293   Most, but not all, of the word-motion-with-operator and end-of-line
7294   anomalies have been recreated. One missing anomaly: In vile, "dw" on the
7295   last word of a line ending in whitespace deletes the trailing whitespace.
7296   vi does not delete the whitespace.
7297
7298   In the real vi, the '_' command is a little-used motion command, which
7299   moves the cursor to the start of the Nth next line, where N is the
7300   argument given, less 1. So '2_' takes you to the start of the next line.
7301   Primarily intended for use in an operator context, as in "2d_", it is
7302   always exactly equivalent in those cases to "stuttering" the operator, as
7303   in "2dd". Most people know about and use the stuttered form, so in vile,
7304   the '_' command is used by default for buffer history. If the regular vi
7305   behavior is desired, put the following in the .vilerc file:
7306
7307       bind-key whole-lines _
7308
7309
7310Sample .vilerc
7311--------------
7312   Here's a sample .vilerc, to help get you started with the syntax and style
7313   of vile macros:
7314
7315       source vileinit.rc
7316       set autoindent
7317       set fillcol 75
7318
7319       ; sitting on a brace, run the C code block through indent
7320       1 store-macro
7321               write-file
7322               filter-til goto-matching-fence "indent -st"
7323       ~endm
7324
7325       ; format the current paragraph
7326       2 store-macro
7327               previous-paragraph
7328               filter-til next-paragraph "/usr/ucb/fmt"
7329       ~endm
7330
7331       ; put 'fprintf(stderr,"\n");' into the file, and
7332       ; position the cursor to add to the string
7333       3 store-macro
7334               ~force next-line
7335               beginning-of-line
7336               insert-string "fprintf(stderr, \"\\n\");\n"
7337               ; six back, because it counts the newline
7338               6 backward-character
7339               insert-chars
7340       ~endm
7341
7342       ; insert '> ' in front of every line from here til the end
7343       ; (this works because without argument, the default action
7344       ; for "goto-line" is to go to the end of file.
7345       4 store-macro
7346               substitute-til goto-line "^" "> "
7347       ~endm
7348
7349       ; spelling keystroke: write the buffer, invoke ispell, and force
7350       ;       it to be read back in.
7351       2 store-macro
7352               ~local $warn-reread
7353               write-file
7354               ; suppress "press return" with "1" argument to shell-command
7355               1 shell-command &cat "ispell " $cfilname
7356               ; suppress reread warning
7357               set nowarn-reread
7358               replace-with-file $cfilname
7359       ~endm
7360       bind-key execute-macro-2 #I
7361
7362       ; the next three give more mnemonic window commands
7363       bind-key next-window ^N
7364       bind-key previous-window ^P
7365       bind-key split-current-window ^T
7366
7367       bind-key execute-macro-1 ^A-C
7368       bind-key execute-macro-2 ^A-F
7369       bind-key execute-macro-3 ^A-K
7370       bind-key execute-macro-4 ^A-M
7371
7372
7373Notes on TERM types and Scrolling
7374---------------------------------
7375   vile will determine the window size in one of three ways: first it will
7376   ask the tty driver (using a TIOCGWINSZ ioctl call under UNIX). Failing
7377   that, it will use the LINES and COLUMNS environment variables. As a last
7378   resort it will use the size specified in the TERMCAP entry corresponding
7379   to the TERM variable. In addition, vile will attempt to support the
7380   SIGWINCH signal, which allows it to track changes to the size of the
7381   window in which it is running.
7382
7383   If scrolling is really slow, or really ugly (the status line hops around a
7384   lot), and you're using a vt102 or compatible terminal that you think
7385   should be able to scroll okay, then the problem is almost certainly your
7386   termcap entry, which probably doesn't describe scrolling regions
7387   adequately. Most standard termcap entries are insufficient. The standard
7388   "xterm" entry on many systems falls into this category, and vile contains
7389   code that, as a special case, will augment an "xterm" entry with the codes
7390   needed for scrolling regions.
7391
7392   In any case, here's a termcap entry that should work:
7393
7394     dy|vt102|vt-102|dec vt102:\
7395             :do=^J:co#80:li#24:cl=50\E[;H\E[2J:\
7396             :le=^H:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\
7397             :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
7398             :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\
7399             :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
7400             :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
7401             :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3:\
7402             :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h:
7403
7404   The crucial entries are cs and sr - without both of them, vile will
7405   attempt to use dl and al, and will scroll by deleting and inserting a
7406   block of lines, giving the ugly behavior you're probably seeing. If you
7407   define PRETTIER_SCROLL when building vile, it will alternately delete and
7408   insert lines, instead of deleting them all and then inserting them all.
7409   This makes it look a _little_ better, but it's slower.
7410
7411   Here is the terminfo entry equivalent to the above termcap entry:
7412
7413     vt102|vt-102|dec vt102,
7414             xon,
7415             cols#80, lines#24, vt#3,
7416             bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
7417             clear=\E[;H\E[2J$<50>, cnorm=\E[?7h, cr=\r,
7418             csr=\E[%i%p1%d;%p2%dr, cub1=\b, cud1=\n,
7419             cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>,
7420             cuu1=\E[A$<2>, cvvis=\E[?7l, ed=\E[J$<50>,
7421             el=\E[K$<3>, home=\E[H, ht=\t, ind=\n,
7422             is2=\E[1;24r\E[24;1H, kbs=\b, kcub1=\EOD, kcud1=\EOB,
7423             kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR,
7424             kf4=\EOS, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>,
7425             rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>,
7426             rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
7427             sgr0=\E[m$<2>, smkx=\E[?1h\E=, smso=\E[7m$<2>,
7428             smul=\E[4m$<2>,
7429
7430
7431Credits
7432-------
7433   (last updated Jan, 2000)
7434
7435   Since version 6.1, Tom Dickey has been maintaining the "official" source
7436   tree, and release responsibilities. Paul Fox maintains the mailing lists.
7437
7438   This code has been written by a _lot_ of people, with help from a lot more
7439   sending in bug reports, fixes, and suggestions. The authors of vile are
7440   Tom Dickey (dickey@invisible-island.net) and Kevin Buettner
7441   (kevin@buettner.to) and Paul Fox (pgf@foxharp.boston.ma.us).
7442
7443   Names appearing within comments in the micro-Emacs source code are: Dave
7444   Conroy, Daniel Lawrence, John Gamble, Roger Ove, Dana Hoggatt, Jon Reid,
7445   Steve Wilhite, George Jones, Adam Fritz, D.R.Banks, Bob McNamara, and
7446   Brian Straight. Dan Lawrence, in particular, did a huge amount of work on
7447   the code on which vile is based. vile re-implements and extends many
7448   features inspired by his work.
7449
7450   Throughout the years, Tom Dickey has contributed many code improvements
7451   and features, and has stabilized vile on both VMS and DOS. After taking
7452   over official maintenance duties, Tom coded winvile, added majormodes,
7453   added 16-color support, and implemented the majority of the current syntax
7454   coloring infrastructure. On an ongoing basis, Tom continues to fix bugs
7455   and provide the drive and energy that pushes out one release of the editor
7456   after another-no small feat for a product that's supported on multiple
7457   hosts.
7458
7459   Kevin Buettner has contributed lots of changes for X11 Toolkit support, as
7460   well as the bulk of the selection and video attribute mechanisms, and the
7461   bulk of the :map command. Kevin also added autocoloring and a Perl
7462   interface to the editor. Rick Sladkey has done great stuff making vile
7463   work correctly in Win32 environments, something I might not have done for
7464   a long time. Some of the "ex" code is by Steve Kirkendall, author of the
7465   vi work-alike "elvis". The regular expression code and documentation is by
7466   Henry Spencer. Dave Lemke contributed code for new features, including the
7467   original native X11 support. Eric Krohn has done some excellent testing
7468   and enhancement. The implementation of rectangles and their operations was
7469   inspired by code from the 'notgnu' editor, by Julie Melbin. Patches to
7470   support OS/2 came from Charles Moschel and for Windows/NT from Joe Greer
7471   and Clark Morgan. Ed Henderson gave us wvwrap, as well as several other
7472   useful patches. Chris Coppick created Vileserv. Alex Wetmore contributed
7473   stored procedures and vile's initial btree interface (the latter later
7474   rewritten by Tom). Brendan O'Dea closely monitors the Perl API, as well as
7475   contributing Perl updates. Brendan also added the machinery for binding
7476   vile commands to Perl subroutines. Better still, he also found a way to
7477   bind operators and motions to same. Kuntal Daftary added several Perl
7478   modules. Clark Morgan and Greg McFarlane seem to run full regression tests
7479   on each new release, and always seem to find something to report. In
7480   addition, Clark regularly updates and corrects the documentation left as
7481   an afterthought by the rest of us. Sean Ahern is also always dependable
7482   for finding a bug or two per release. The reference.doc file supplied with
7483   Bram Moolenaar's excellent Vim editor was useful in unraveling some of the
7484   less obvious parts of :map functionality. In addition, his implementation
7485   of digraph insertion was used directly in the creation of digraphs.rc.
7486   Thanks to Jukka Keto for contributing the c-filt.c code, which served as
7487   the precursor for vile's current syntax coloring implementation.
7488
7489   The initial changes to create vile from micro-Emacs were all done by Paul
7490   Fox (pgf@foxharp.boston.ma.us). (By the way, he is not the Paul D. Fox
7491   that wrote the Crisp editor.)
7492
7493   - Paul Fox
7494
7495
7496Where to Get It
7497---------------
7498   vile's homepage is
7499   https://invisible-island.net/vile/
7500
7501   Up-to-date copies of vile, including executables for DOS, Win32 and OS/2
7502   are found at
7503
7504     * ftp://ftp.invisible-island.net/vile/
7505
7506   which is mirrored at
7507
7508     * http://invisible-mirror.net/archives/vile/
7509
7510   There are also links on vile's homepage, for both ftp and http connections
7511   for the most often used executables and sources.
7512
7513   Development patches are found at
7514
7515     * ftp://ftp.invisible-island.net/vile/patches/
7516     * http://invisible-mirror.net/archives/vile/patches/
7517
7518   In addition, we have distributed copies at other sites, including
7519   metalabs.unc.edu (Linux), hobbes.nmsu.edu (OS/2) and the VMS Freeware
7520   CDROM's.
7521
7522
7523Problems
7524--------
7525   Submit bug reports via the project mailing list, or via the web-based bug
7526   reporting system. Both of these are available here:
7527   https://savannah.nongnu.org/projects/vile
7528
7529   Subscribing to the mailing list is also the best way to keep informed of
7530   new releases.
7531
7532
7533Online resources
7534----------------
7535   This information is also available online:
7536
7537     * http://invisible-island.net/vile/vile-toc.html (table of contents)
7538
7539     * http://invisible-island.net/vile/vile-hlp.html (this file)
7540
7541
7542Copyright
7543---------
7544   Copyright (c) 1995-2020,2021 by Paul Fox, Thomas Dickey, and Kevin Buettner
7545
7546-- (generated by make-hlp.pl from vile-hlp.html(1.121))
7547-- vile:txtmode fillcol=78
7548-- $Id: vile.hlp,v 1.764 2021/11/30 09:04:05 tom Exp $
7549