Previous Table of Contents Next


ex has internal variables (switches) which allow you to set options for special effects or customizing of ex/vi. There are three types of these variables:

*  Boolean, toggle on or off (:set option)
*  Numeric, assign a numeric value (:set option=val)
*  Alphanumeric string, assign a string value (:set option=str)

There are three ways to set variables:

*  Setting the 'EXINIT' shell variable
*  Defining the values in the .exrc file
*  Using :set while in ex/vi

The following commands are used with ex/vi to display the options.

set Display only options that have been changed.
set all Display all options and current setting.
set [opt] ? Display current setting for given [opt].

The Options

Precede each of the following with set. The abbreviated version of each variable follows in ( ) if it exists.

Option Default Description

autoindent(ai) noai ex/vi will indent the next line the same as current line while in insert mode. Ctrl-T moves the indention right one tab or Ctrl-D moves it left one tab.
autoprint(ap) ap Displays the current line after each ex command that modifies text. The lines affected by the g and v options are not displayed.
autowrite(aw) noaw Causes an automatic write to disk if :!, :tag, :next, :rewind, Ctrl-^, Ctrl-[, or Esc commands are used with unsaved changes.
beautify(bf) nobf Discards all control characters except tab, new-line, and form-feed from the input.
directory(dir) dir=/tmp Directory where ex/vi stores temporary buffer and register files. The editor must have read and write permissions for the directory.
edcompatible(ed) noed Causes ex to change how it handles the substitute suffixes g and c. The g and c options used on substitute commands become toggles. The first use of g causes all subsequent substitutes to be global in effect until the next g is used. The c is for confirmation of substitutes.
errorbells(eb) noeb Precede error messages by a bell. For the sleepy user or the visually impaired.
hardtabs(ht) ht=8 Specify hardware tab spacing.
ignorecase(ic) noic Map all uppercase letters to lowercase letters in regular expression matching. In other words, ignore whether a letter is uppercase or lowercase when performing searches.
lisp nolisp Autoindent for LISP code. The |, [[, and ]] are changed to affect s- expressions and functions.
list nolist Display tab and new-line visually. Tabs appear as ^I and the end-of-line (new-line) appears as $.
magic magic Enable metacharacters for matching. If magic is set then ., *, [, and \ are considered to be magic (metacharacters) in patterns used for searches and substitutions.
mesg mesg Allow messages from other users' commands, such as write and talk, to interrupt your edit session. For those who like to communicate with others. See the UNIX mesg command.
novice Set by invoking the editor as vedit for beginner mode. Displays when you are in insert mode and various other help type messages.
number(nu) nonu Line numbering. Line numbers are displayed to the left of each line in the buffer. The line numbers are only on the display; they are not placed in the text.
open open Allow open mode from ex mode. Allows you to enter open window mode from the ex editor mode.
optimize(opt) opt Tries to speed up ex formatting if possible.
paragraphs(para) para=IPLPPPQPP LIpplpipbp
Set paragraph delimiters used by the { and } commands. The IPLPPPQPP LIpplpipbp string considers the .IP, .LP, .PP, .QP, .P , .LI, .pp, .lp, .ip, and .bp to be paragraph delimiters. If you use a space as a delimiter, precede it with a backslash (\).
prompt prompt The : prompt will be printed when in ex mode.
readonly(ro) noro Set to read-only mode, disables write capability. The view command invokes vi with this option set.
redraw(re) nore Keep dumb terminals updated continuously. Normally vi inserts an @ sign in place of a deleted line on a dumb terminal. If Redraw is set, the screen is updated to remove these deleted lines. Extremely costly on output, but if you have a dumb terminal and a high baud rate it's nice.
remap remap Allow macros within macros. If a is mapped to b, and b is mapped to c, then a is mapped to c automatically.
report report=10 Report modifications at the bottom of the screen if the set number of lines are modified.
scroll scroll=11 Number of lines to scroll when using Ctrl-U or Ctrl-D commands.
sections(sect) sec=NHSHHHU Set sections delimiters used by the [[ and ]] commands. Works the same as the paragraphs option.
shell shell=/bin/sh Name of shell to use when a shell is invoked from vi. The $SHELL variable is used if it is defined and exported.
shiftwidth(sw) sw=8 The number of spaces the text is indented by using the Ctrl-T, Ctrl-D, and Tab keys and the < and > commands and the autoindent option.
showmatch(sm) nosm In the visual mode this option causes the editor to show the matching ( or { for every } or ) you typed.
showmode noshowmode Shows the current mode of the editor; informs you if you are in INSERT, COMMAND, or EX mode. Some editors do not support this option.
slowopen(slow) slow Slows the updating of dumb terminals. During insertions the text is not updated to resemble the immediate changes. Speeds up overall perform- ance at the expense of clarity. Just remember to use Ctrl-R or Ctrl-L enough to know what you are changing.
tabstop(ts) ts=8 Expand tab to boundaries that are multiples of the value provided.
taglength(tl) tl=0 The number of significant characters in a tag; 0 means all characters are significant.
tags tags=/usr/lib/tags Set directory path of tag file.
term $TERM Terminal type used by vi for screen control. Cannot be set in vi. May enter a Q, set term, then reenter vi.
terse noterse Short error diagnostic messages. As if they were ever explanatory enough.
timeout(to) noto Allows a shell or system timeout to abort the edit session.
ttytype(tty) Terminal type. Left over from the dark ages when vi was still a dream.
warn warn Warns of escaping to the shell without a current save to disk of the buffer.
wXXX stty BAUD Set window size according to baud rate XXX. Valid wXXX are w300, w1200, w2400, w4800, w9600.
window window=14 Set number of lines in window. Initial set of the window size uses the wXXX option. Each time you move from the current window and require a new window to be drawn, n number of lines are used for the initial window.
wrapmargin(wm) wm=0 Automatic new line inserted wm spaces from the right margin during insert mode. It is advisable to place this option in your EXINIT variable. Long lines can cause problems in document processing.
wrapscan(ws) ws Searches will wrap around the end of the file and continue until the current line is reached again.
writeany(wa) nowa No safety checks are done before saving a file. The contents of the session buffer are written to disk without checking current status of disk file or buffer condition. The good side is you always have a copy on disk. The bad side is you may write something to disk you don't want.

Previous Table of Contents Next