386BSD 0.1 development
[unix-history] / usr / src / usr.bin / elvis / doc / options.ms
CommitLineData
f5bcab4b
WJ
1.Go 5 "OPTIONS"
2.PP
3Options may be set or examined via the colon command "set".
4The values of options will affect the operation of later commands.
5.PP
6For convenience, options have both a long descriptive name and a short name
7which is easy to type.
8You may use either name interchangably.
9I like the short names, myself.
10.PP
11There are three types of options: Boolean, string, and numeric.
12Boolean options are made TRUE by giving the name of the option as an
13argument to the "set" command;
14they are made FALSE by prefixing the name with "no".
15For example, "set autoindent" makes the autoindent option TRUE,
16and "set noautoindent" makes it FALSE.
17\*E also allows boolean options to be toggled by prefixing the name with "neg".
18So, ":map g :set neglist^M" will cause the <g> key to alternately toggle the
19"list" option on and off.
20(The "neg" prefix is an extension; the real vi doesn't support it.)
21.PP
22To change the value of a string or numeric option, pass the "set" command
23the name of the option, followed by an "=" sign and the option's new value.
24For example, "set tabstop=8" will give the tabstop option a value of 8.
25For string options, you may enclose the new value in quotes.
26.LD
27.ta 1.9i 2.4i 3.8i
28.ps +2
29\fBNAMES TYPE DEFAULT MEANING\fP
30.ps
31autoindent, ai Bool noai auto-indent during input
32autoprint, ap Bool ap in EX, print the current line
33autotab, at Bool at auto-indent allowed to use tabs?
34autowrite, aw Bool noaw auto-write when switching files
35beautify, bf Bool nobf strip control chars from file?
36charattr, ca Bool noca interpret \\fX sequences?
37cc, cc Str cc="cc -c" name of the C compiler
38columns, co Num co=80 width of the screen
39digraph, dig Bool nodig recognize digraphs?
40directory, dir Str dir="/usr/tmp" where tmp files are kept
41edcompatible, ed Bool noed remember ":s//" options
42equalprg, ep Bool ep="fmt" program to run for = operator
43errorbells, eb Bool eb ring bell on error
44exrc, exrc Bool noexrc read "./.exrc" file?
45exrefresh, er Bool er write lines indiviually in EX
46flash, vbell Bool flash use visible alternative to bell
47flipcase, fc Str fc="" non-ASCII chars flipped by ~
48hideformat, hf Bool hf hide text formatter commands
49ignorecase, ic Bool noic upper/lowercase match in search
50inputmode, im Bool noim start vi in insert mode?
51keytime, kt Num kt=2 timeout for mapped key entry
52keywordprg, kp Str kp="ref" full pathname of shift-K prog
53lines, ln Num ln=25 number of lines on the screen
54list, li Bool noli display lines in "list" mode
55magic, ma Bool ma use regular expression in search
56make, mk Str mk="make" name of the "make" program
57mesg, ms Bool ms allow messages from other users?
58modelines, ml Bool noml are modelines processed?
59more, more Bool more pause between messages?
60novice, nov Bool nonovice set options for ease of use
61paragraphs, para Str para="PPppIPLPQP" names of "paragraph" nroff cmd
62prompt, pr Bool pr show ':' prompt in \fIex\fR mode
63readonly, ro Bool noro prevent overwriting of orig file
64remap, rem Bool remap allow key maps to call key maps
65report, re Num re=5 report when 5 or more changes
66ruler, ru Bool noru display line/column numbers
67scroll, sc Num sc=12 scroll amount for ^U and ^D
68sections, sect Str sect="NHSHSSSEse" names of "section" nroff cmd
69shell, sh Str sh="/bin/sh" full pathname of the shell
70showmatch, sm Bool nosm show matching ()[]{}
71showmode, smd Bool nosmd say when we're in input mode
72shiftwidth, sw Num sw=8 shift amount for < and >
73sidescroll, ss Num ss=8 amount of sideways scrolling
74sync, sy Bool nosy call sync() often
75tabstop, ts Num ts=8 width of tab characters
76taglength, tl Num tl=0 significant chars in tag name
77term, te Str te="$TERM" name of the termcap entry
78terse, tr Bool notr give shorter error messages
79timeout, to Bool to distinguish <esc> from <arrow>?
80warn, wa Bool wa warn for ! if file modified
81window, wi Num wi=24 lines to redraw after long move
82wrapmargin, wm Num wm=0 wrap long lines in input mode
83wrapscan, ws Bool ws at EOF, searches wrap to line 1
84writeany, wr Bool nowr allow :w to clobber files
85.DE
86.TA
87.ne 6
88.IP "autoindent, ai"
89During input mode, the autoindent option will cause each added line
90to begin with the same amount of leading whitespace as the line above it.
91Without autoindent, added lines are initially empty.
92.IP "autoprint, ap"
93This option only affects EX mode.
94If the autoprint option on,
95and either the cursor has moved to a different line
96or the previous command modified the file,
97then \*E will print the current line.
98.IP "autotab, at"
99This option affects the behaviour of the autoindent mode.
100If autoindent is turned off, then autotab has no effect.
101.IP
102When autotab is turned on, elvis will use a mixture of spaces and tabs
103to create the proper amount of indentation.
104This is the default.
105.IP
106When autotab is turned off, elvis will only use spaces for auto-indent.
107\*E will still insert a real tab character when you hit the <Tab> key, though;
108the autotab option only affects \fIautomatic\fR indentation.
109.IP "autowrite, aw"
110When you're editing one file and decide to switch to another
111\- via the :tag command, or :next command, perhaps \-
112if your current file has been modified,
113then \*E will normally print an error message and refuse to switch.
114.IP
115However, if the autowrite option is on,
116then \*E will write the modified version of the current file
117and successfully switch to the new file.
118.IP "beautify, bf"
119This option causes all control characters to be deleted from the text file,
120at the time when you start editing it.
121If you're already editing a file when you turn on the beautify option,
122then that file won't be affected.
123.IP cc
124The :cc command runs the C compiler.
125This option should be set to the name of your compiler.
126.IP "charattr, ca"
127Many text formatting programs allow you to designate portions of
128your text to be underlined, italicized, or boldface by embedding
129the special strings \\fU, \\fI, and \\fB in your text.
130The special string \\fP marks the end of underlined or boldface text.
131.IP
132\*E normally treats those special strings just like any other text.
133.IP
134However, if the charattr option is on, then \*E will interpret
135those special strings correctly,
136to display underlined or boldface text on the screen.
137(This only works, of course, if your terminal can display
138underlined and boldface, and if the TERMCAP entry says how to do it.)
139.IP "columns, co"
140This option shows how wide your screen is.
141.IP "digraph, dig"
142This option is used to enable/disable recognition of digraphs.
143The default value is nodigraph, which means that digraphs will not be
144recognized.
145.IP "directory, dir"
146\*E stores text in temporary files.
147This option allows you to control which directory those temporary files will
148appear in.
149The default is /usr/tmp.
150.IP
151This option can only be set in a .exrc file;
152after that, \*E will have already started making temporary files
153in some other directory, so it would be too late.
154.IP "edcompatible, ed"
155This option affects the behaviour of the ":s/regexp/text/options" command.
156It is normally off (:se noed) which causes all of the substitution options
157to be off unless explicitly given.
158.IP
159However, with edcompatible on (:se ed), the substitution command remembers
160which options you used last time.
161Those same options will continue to be used until you change them.
162In edcompatible mode, when you explicitly give the name of a
163substitution option, you will toggle the state of that option.
164.IP
165This all seems very strange to me, but its implementation was almost free
166when I added the ":&" command to repeat the previous substitution,
167so there it is.
168.IP "equalprg, ep"
169This holds the name & arguments of the external filter program
170used the the visual = operator.
171The defualt value is "fmt",
172so the = operator will adjust line breaks in text.
173.IP "errorbells, eb"
174\*E normally rings a bell when you do something wrong.
175This option lets you disable the bell.
176.IP exrc
177This option specifies whether a .exrc file in the current directory
178should be executed.
179By default, this option is off (":set noexrc") which prevents elvis from
180executing .exrc in the current directory.
181If the .exrc file in your home directory turns this option on (":set exrc")
182then the \*E will attempt to execute the .exrc file in the current directory.
183.IP
184This option exist mainly for security reasons.
185A mean-spirited person could do something like
186.br
187 echo >/tmp/.exrc '!rm -rf $HOME'
188.br
189and then anybody who attempted to edit or view a file in the /tmp directory
190would lose most of their files.
191With the exrc option turned off, this couldn't happen to you.
192.IP "exrefresh, er"
193The EX mode of \*E writes many lines to the screen.
194You can make \*E either write each line to the screen separately,
195or save up many lines and write them all at once.
196.IP
197The exrefresh option is normally on, so each line is written to the
198screen separately.
199.IP
200You may wish to turn the exrefresh option off (:se noer) if the
201"write" system call is costly on your machine, or if you're using a
202windowing environment.
203(Windowing environments scroll text a lot faster when you write
204many lines at once.)
205.IP
206This option has no effect in visual command mode or input mode.
207.IP "flash, vbell"
208If your termcap entry describes a visible alternative to ringing
209your terminal's bell, then this option will say whether the visible
210version gets used or not.
211Normally it will be.
212.IP
213If your termcap does NOT include a visible bell capability,
214then the flash option will be off, and you can't turn it on.
215.IP "flipcase, fc"
216The flipcase option allows you to control how the non-ASCII characters are
217altered by the "~" command.
218.IP
219The string is divided into pairs of characters.
220When "~" is applied to a non-ASCII character,
221\*E looks up the character in the flipcase string to see which pair it's in,
222and replaces it by the other character of the pair.
223.IP "hideformat, hf"
224Many text formatters require you to embed format commands in your text,
225on lines that start with a "." character.
226\*E normally displays these lines like any other text,
227but if the hideformat option is on,
228then format lines are displayed as blank lines.
229.IP "ignorecase, ic"
230Normally, when \*E searches for text, it treats uppercase letters
231as being different for lowercase letters.
232.IP
233When the ignorecase option is on, uppercase and lowercase are treated as equal.
234.IP "inputmode, im"
235This option allows you to have \*E start up in insert mode.
236You can still exit insert mode at any time by hitting the ESC key, as usual.
237Usually, this option would be set in your ".exrc" file.
238.IP "keytime, kt"
239The arrow keys of most terminals send a multi-character sequence.
240It takes a measurable amount of time for these sequences to be transmitted.
241The keytime option allows you to control the maximum amount of time
242to allow for an arrow key (or other mapped key) to be received in full.
243.IP
244On most systems, the setting is the number of tenths of a second to allow
245between characters.
246On some other systems, the setting is in whole seconds.
247.IP
248Try to avoid setting keytime=1.
249Most systems just count clock beats, so if you tried to read a character
250shortly before a clock beat, you could allow almost no time at all for
251reading the characters.
252For higher keytime settings, the difference is less critical.
253.IP
254If your system's response time is poor, you might want to increase the keytime.
255In particular, I've found that when keystrokes must be sent through a network
256(via X windows, rlogin, or telnet, for example) the keytime should be set to
257at least 1 second.
258.IP
259As a special case,
260you can set keytime to 0 to disable this time limit stuff altogether.
261The big problem here is:
262If your arrow keys' sequences start with an ESC,
263then every time you hit your ESC key \*E will wait... and wait...
264to see if maybe that ESC was part of an arrow key's sequence.
265.IP
266NOTE: this option is a generalization of the timeout option of the real vi.
267.IP "keywordprg, kp"
268\*E has a special keyword lookup feature.
269You move the cursor onto a word, and hit shift-K,
270and \*E uses another program to look up the word
271and display information about it.
272.IP
273This option says which program gets run.
274.IP
275The default value of this option is "ref",
276which is a program that looks up the definition of a function in C.
277It looks up the function name in a file called "refs" which is created by ctags.
278.IP
279You can subtitute other programs, such as an English dictionary program
280or the online manual.
281\*E runs the program, using the keyword as its only argument.
282The program should write information to stdout.
283The program's exit status should be 0, unless you want \*E to print
284"<<< failed >>>".
285.IP "lines, ln"
286This option says how many lines you screen has.
287.IP "list, li"
288In nolist mode (the default), \*E displays text in a "normal" manner
289-- with tabs expanded to an appropriate number of spaces, etc.
290.IP
291However, sometimes it is useful to have tab characters displayed differently.
292In list mode, tabs are displayed as "^I",
293and a "$" is displayed at the end of each line.
294.IP "magic, ma"
295The search mechanism in \*E can accept "regular expressions"
296-- strings in which certain characters have special meaning.
297.IP
298The magic option is normally on, which causes these characters to be treated
299specially.
300.IP
301If you turn the magic option off (:se noma),
302then all characters except ^ and $ are treated literally.
303^ and $ retain their special meanings regardless of the setting of magic.
304.IP "make, mk"
305The :make command runs your "make" program.
306This option defines the name of your "make" program.
307.IP mesg
308With the real vi, running under real UNIX,
309":set nomesg" would prevent other users from sending you messages.
310\*E ignores it, though.
311.IP "modelines, ml"
312\*E supports modelines.
313Modelines are lines near the beginning or end of your text file which
314contain "ex:yowza:",
315where "yowza" is any EX command.
316A typical "yowza" would be something like "set ts=5 ca kp=spell wm=15".
317Other text may also appear on a modeline,
318so you can place the "ex:yowza:" in a comment:
319.br
320.ID
321/* ex:set sw=4 ai: */
322.DE
323.IP
324Normally these lines are ignored, for security reasons,
325but if you have "set modelines" in your .exrc file
326then "yowza" is executed.
327.IP "novice, nov"
328The command ":set novice" is equivelent to ":set nomagic report=1 showmode".
329.IP "paragraphs, pa"
330The { and } commands move the cursor forward or backward in increments
331of one paragraph.
332Paragraphs may be separated by blank lines, or by a "dot" command of
333a text formatter.
334Different text formatters use different "dot" commands.
335This option allows you to configure \*E to work with your text formatter.
336.IP
337It is assumed that your formatter uses commands that start with a
338"." character at the front of a line,
339and then have a one- or two-character command name.
340.IP
341The value of the paragraphs option is a string in which each pair
342of characters is one possible form of your text formatter's paragraph
343command.
344.IP "more"
345When \*E must display a sequence of messages at the bottom line of the screen
346in visual mode, it normally pauses after all but the last one, so you have
347time to read them all.
348.IP
349If you turn off the "more" option, then \*E will not pause.
350This means you can only read the last message, but it is usually the most
351important one anyway.
352.IP "prompt, pr"
353If you ":set noprompt", then \*E will no longer emit a ':' when it
354expects you to type in an \fIex\fR command.
355This is slightly useful if you're using an astonishingly slow UNIX machine,
356but the rest of us can just ignore this one.
357.IP "readonly, ro"
358Normally, \*E will let you write back any file to which you have
359write permission.
360If you don't have write permission, then you can only write the changed
361version of the file to a \fIdifferent\fP file.
362.IP
363If you set the readonly option,
364then \*E will pretend you don't have write permission to \fIany\fP file you edit.
365It is useful when you really only mean to use \*E to look at a file,
366not to change it.
367This way you can't change it accidentally.
368.IP
369This option is normally off, unless you use the "view" alias of \*E.
370"View" is like "vi" except that the readonly option is on.
371.IP "remap"
372The ":map" command allows you to convert one key sequence into another.
373The remap option allows you to specify what should happen if portions of
374that other sequence are also in the map table.
375If remap is on, then those portions will also be mapped, just as if they
376had been typed on the keyboard.
377If remap is off, then the matching portions will not be mapped.
378.IP
379For example, if you enter the commands ":map A B" and ":map B C",
380then when remap is on, A will be converted to C.
381But when remap is off, A will be converted only to B.
382.IP "report, re"
383Commands in \*E may affect many lines.
384For commands that affect a lot of lines, \*E will output a message saying
385what was done and how many lines were affected.
386This option allows you to define what "a lot of lines" means.
387The default is 5, so any command which affects 5 or more lines will cause
388a message to be shown.
389.IP "ruler, ru"
390This option is normally off.
391If you turn it on, then \*E will constantly display the line/column numbers
392of the cursor, at the bottom of the screen.
393.IP "scroll, sc"
394The ^U and ^D keys normally scroll backward or forward by half a screenful,
395but this is adjustable.
396The value of this option says how many lines those keys should scroll by.
397If you invoke ^U or ^D with a count argument (for example, "33^D") then
398this option's value is set to the count.
399.IP "sections, se"
400The [[ and ]] commands move the cursor backward or forward in increments of
4011 section.
402Sections may be delimited by a { character in column 1
403(which is useful for C source code)
404or by means of a text formatter's "dot" commands.
405.IP
406This option allows you to configure \*E to work with your text formatter's
407"section" command, in exectly the same way that the paragraphs option makes
408it work with the formatter's "paragraphs" command.
409.IP "shell, sh"
410When \*E forks a shell
411(perhaps for the :! or :shell commands)
412this is the program that is uses as a shell.
413This is "/bin/sh" by default,
414unless you have set the SHELL (or COMSPEC, for MS-DOS) environment variable,
415it which case the default value is copied from the environment.
416.IP "shiftwidth, sw"
417The < and > commands shift text left or right by some uniform number of columns.
418The shiftwidth option defines that "uniform number".
419The default is 8.
420.IP "showmatch, sm"
421With showmatch set,
422in input mode every time you hit one of )}],
423\*E will momentarily move the cursor to the matching ({[.
424.IP "showmode, smd"
425In visual mode, it is easy to forget whether you're in the visual command mode
426or input/replace mode.
427Normally, the showmode option is off, and you haven't a clue as to which mode
428you're in.
429If you turn the showmode option on, though, a little message will appear in the
430lower right-hand corner of your screen, telling you which mode you're in.
431.IP "sidescroll, ss"
432For long lines, \*E scrolls sideways.
433(This is different from the real vi,
434which wraps a single long line onto several rows of the screen.)
435.IP
436To minimize the number of scrolls needed,
437\*E moves the screen sideways by several characters at a time.
438The value of this option says how many characters' widths to scroll at a time.
439.IP
440Generally, the faster your screen can be redrawn,
441the lower the value you will want in this option.
442.IP "sync, sy"
443If the system crashes during an edit session, then most of your work
444can be recovered from the temporary file that \*E uses to store
445changes.
446However, sometimes the OS will not copy changes to the
447hard disk immediately, so recovery might not be possible.
448The [no]sync option lets you control this.
449.IP
450In nosync mode (which is the default, for UNIX), \*E lets the operating system
451control when data is written to the disk.
452This is generally faster.
453.IP
454In sync mode (which is the default for MS-DOS, AmigaDos, and Atari TOS),
455\*E forces all changes out
456to disk every time you make a change.
457This is generally safer, but slower.
458It can also be a rather rude thing to do on a multi-user system.
459.IP "tabstop, ts"
460Tab characters are normally 8 characters wide,
461but you can change their widths by means of this option.
462.IP "taglength, tl"
463This option allows you to specify how many characters of a tag's name
464must match when performing tag lookup.
465As a special case, ":set taglength=0" means that all characters of a tag's
466name must match.
467.IP
468Note: some configurations of \*E don't support this option.
469.IP "term, te"
470This read-only option shows the name of the termcap entry that
471\*E is using for your terminal.
472.IP "terse, tr"
473The real vi uses this option to select longer vs. shorter error messages.
474\*E has only one set of error messages, though, so this option has no effect.
475.IP "timeout, to"
476The command ":set notimeout" is equivelent to ":set keytime=0",
477and ":set timeout" is equivelent to ":set keytime=1".
478This affects the behaviour of the <Esc> key.
479See the discussion of the "keytime" option for more information.
480.IP "warn, wa"
481If you have modified a file but not yet written it back to disk, then
482\*E will normally print a warning before executing a ":!cmd" command.
483However, in nowarn mode, this warning is not given.
484.IP
485\*E also normally prints a message after a successful search that
486wrapped at EOF.
487The [no]warn option can also disable this warning.
488.IP "window, wi"
489This option controls how many lines are redrawn after a long move.
490.IP
491On fast terminals, this is usually set to the number of rows that the
492terminal can display, minus one.
493This causes the entire screen to be filled with text around the cursor.
494.IP
495On slow terminals, you may wish to reduce this value to about 7 or so.
496That way, if you're doing something like repeatedly hitting 'n' to search
497for each occurrence of some string and trying to find a particular occurrence,
498then you don't need to wait as long for \*E to redraw the screen after each
499search.
500.IP "wrapmargin, wm"
501Normally (with wrapmargin=0) \*E will let you type in extremely long
502lines, if you wish.
503.IP
504However, with warpmargin set to something other that 0 (wrapmargin=10
505is nice), \*E will automatically cause long lines to be "wrapped"
506on a word break for lines come too close to the right-hand margin.
507For example: On an 80-column screen, ":set wm=10" will cause lines to
508wrap when their length exceeds 70 columns.
509.IP "wrapscan, ws"
510Normally, when you search for something, \*E will find it no matter
511where it is in the file.
512\*E starts at the cursor position, and searches forward.
513If \*E hits EOF without finding what you're looking for,
514then it wraps around to continue searching from line 1.
515If you turn off the wrapscan option (:se nows),
516then when \*E hits EOF during a search, it will stop and say so.
517.IP "writeany, wr"
518With "writeany" turned off, elvis will prevent you from accidentally
519overwriting a file.
520For example, if "foo" exists then ":w foo" will fail.
521If you turn on the "writeany" option, then ":w foo" will work.
522.IP
523Regardless of the setting of "writeany", though, ":w! foo" will work.
524The '!' forces the ":w" command to write the file unless the operating system
525won't allow it.