Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Setting Options: Appendix B - Learning the vi and Vim Editors, Seventh Edition

by Linda Lamb, Arnold Robbins, Elbert Hannah
Learning the vi and Vim Editors, Seventh Edition book cover

This excerpt is from Learning the vi and Vim Editors, Seventh Edition.

The standard guide for vi since 1986, this book has been expanded to include detailed information on vim, the leading vi clone that includes extra features for both beginners and power users. You learn text editing basics and advanced tools for both editors, such as writing macros and scripts to extend the editor, power tools for programmers, multi-window editing -- all in the easy-to-follow style that has made this book a classic.

buy button

This appendix describes the important set command options for Solaris vi, nvi 1.79, elvis 2.2, Vim 7.1, and vile 9.6.

Solaris vi Options

Table B.1, “Solaris vi set options” contains brief descriptions of the important set command options. In the first column, options are listed in alphabetical order; if the option can be abbreviated, that abbreviation is shown in parentheses. The second column shows the default setting that vi uses unless you issue an explicit set command (either manually or in the .exrc file). The last column describes what the option does, when enabled.

Table B.1. Solaris vi set options

OptionDefaultDescription
autoindent (ai) noai

In insert mode, indents each line to the same level as the line above or below. Use with the shiftwidth option.

autoprint (ap) ap

Display changes after each editor command. (For global replacement, display last replacement.)

autowrite (aw) noaw

Automatically write (save) the file if changed before opening another file with :n or before giving a Unix command with :!.

beautify (bf) nobf

Ignore all control characters during input (except tab, newline, or form feed).

directory (dir) /tmp

Names directory in which ex/vi stores buffer files. (Directory must be writable.)

edcompatible

noedcompatible

Remember the flags used with the most recent substitute command (global, confirming), and use them for the next substitute command. Despite the name, no version of ed actually does this.

errorbells (eb) errorbells Sound bell when an error occurs.
exrc (ex) noexrc

Allow the execution of .exrc files that reside outside the user’s home directory.

flash (fp)

nofp

Flash the screen instead of ringing the bell.

hardtabs (ht) 8

Define boundaries for terminal hardware tabs.

ignorecase (ic) noic

Disregard case during a search.

lisp nolisp

Insert indents in appropriate Lisp format. ( ), { }, [[, and ]] are modified to have meaning for Lisp.

list nolist

Print tabs as ^I; mark ends of lines with $. (Use list to tell whether end character is a tab or a space.)

magic magic

Wildcard characters . (dot), * (asterisk), and [] (brackets) have special meaning in patterns.

mesg mesg

Permit system messages to display on terminal while editing in vi.

novice nonovice

Require the use of long ex command names, such as copy or read.

number (nu) nonu

Display line numbers on left of screen during editing session.

open open

Allow entry to open or visual mode from ex. Although not in Solaris vi, this option has traditionally been in vi, and may be in your Unix’s version of vi.

optimize (opt) noopt

Abolish carriage returns at the end of lines when printing multiple lines; this speeds output on dumb terminals when printing lines with leading whitespace (spaces or tabs).

paragraphs (para)

IPLPPPQP LIpplpipbp

Define paragraph delimiters for movement by { or }. The pairs of characters in the value are the names of troff macros that begin paragraphs.

prompt prompt

Display the ex prompt (:) when vi’s Q command is given.

readonly (ro) noro

Any writes (saves) of a file fail unless you use ! after the write (works with w, ZZ, or autowrite).

redraw (re)

vi redraws the screen whenever edits are made (in other words, insert mode pushes over existing characters, and deleted lines immediately close up). Default depends on line speed and terminal type. noredraw is useful at slow speeds on a dumb terminal: deleted lines show up as @, and inserted text appears to overwrite existing text until you press ESC.

remap remap

Allow nested map sequences.

report 5

Display a message on the status line whenever you make an edit that affects at least a certain number of lines. For example, 6dd reports the message “6 lines deleted.”

scroll [½ window]

Number of lines to scroll with ^D and ^U commands.

sections (sect) SHNHH HU

Define section delimiters for [[ and ]] movement. The pairs of characters in the value are the names of troff macros that begin sections.

shell (sh) /bin/sh

Pathname of shell used for shell escape (:!) and shell command (:sh). Default value is derived from shell environment, which varies on different systems.

shiftwidth (sw) 8

Define number of spaces in backward (^D) tabs when using the autoindent option, and for the << and >> commands.

showmatch (sm) nosm

In vi, when ) or } is entered, cursor moves briefly to matching ( or {. (If no match, ring the error message bell.) Very useful for programming.

showmode noshowmode

In insert mode, display a message on the prompt line indicating the type of insert you are making, for example, “OPEN MODE” or “APPEND MODE.”

slowopen (slow)

Hold off display during insert. Default depends on line speed and terminal type.

tabstop (ts) 8

Define number of spaces that a tab indents during editing session. (Printer still uses system tab of 8.)

taglength (tl) 0

Define number of characters that are significant for tags. Default (zero) means that all characters are significant.

tags

tags /usr/lib/tags

Define pathname of files containing tags. (See the Unix ctags command.) By default, vi searches the file tags in the current directory and /usr/lib/tags.

tagstack tagstack

Enable stacking of tag locations on a stack.

term Set terminal type.
terse noterse

Display shorter error messages.

timeout (to) timeout

Keyboard maps time out after 1 second.[a]

ttytype

Set terminal type. This is just another name for term.

warn warn

Display the warning message, “No write since last change.”

window (w)

Show a certain number of lines of the file on the screen. Default depends on line speed and terminal type.

wrapmargin (wm) 0

Define right margin. If greater than zero, automatically inserts carriage returns to break lines.

wrapscan (ws) ws

Searches wrap around either end of file.

writeany (wa) nowa Allow saving to any file.

[a] When you have mappings of several keys (for example, :map zzz 3dw), you probably want to use notimeout. Otherwise, you need to type zzz within one second. When you have an insert mode mapping for a cursor key (for example, :map! ^[OB ^[ja), you should use timeout. Otherwise, vi won’t react to ESC until you type another key.


nvi 1.79 Options

nvi 1.79 has a total of 78 options that affect its behavior. Table B.2, “nvi 1.79 set options” summarizes the most important ones. Most options described in Table B.1, “Solaris vi set options” are not repeated here.

Table B.2. nvi 1.79 set options

OptionDefaultDescription
backup

A string describing a backup filename to use. The current contents of a file are saved in this file before writing the new data out. A first character of N causes nvi to include a version number at the end of the file; version numbers are always incremented. "N%.bak" is a reasonable example.

cdpath

Environment variable CDPATH, or current directory

A search path for the :cd command.

cedit  

When the first character of this string is entered on the colon command line, nvi opens a new window on the command history that you can then edit. Hitting ENTER on any given line executes that line. ESC is a good choice for this option. (Use ^V ^[ to enter it.)

comment nocomment

If the first nonempty line begins with /*, //, or #, nvi skips the comment text before displaying the file. This avoids displaying long, boring legal notices.

directory (dir)

Environment variable TMPDIR, or /tmp

The directory where nvi puts its temporary files.

extended noextended

Searches use egrep-style extended regular expressions.

filec  

When the first character of this string is entered on the colon command line, nvi treats the blank delimited word in front of the cursor as if it had an * appended to it and does shell-style filename expansion. ESC is also a good choice for this option. (Use ^V ^[ to enter it.) When this character is the same as for the cedit option, command-line editing is performed only when the character is entered as the first character on the colon command line.

iclower noiclower

Make all regular expression searches case-insensitive, as long as the search pattern contains no uppercase letters.

leftright noleftright

Long lines scroll the screen left to right, instead of wrapping.

lock lock

nvi attempts to get an exclusive lock on the file. Editing a file that cannot be locked creates a read-only session.

octal nooctal

Display unknown characters in octal, instead of in hexadecimal.

path

A colon-separated list of directories in which nvi will look for the file to be edited.

recdir /var/tmp/vi.recover

The directory where recovery files are stored.

ruler noruler

Displays the row and column of the cursor.

searchincr nosearchincr

Searches are done incrementally.

secure nosecure

Turn off access to external programs via text filtering (:r!, :w!), disable the vi mode ! and ^Z commands, and the ex mode !, shell, stop, and suspend commands. Once set, it cannot be changed.

shellmeta ~{[*?$`'"\

When any of these characters appear in a filename argument to an ex command, the argument is expanded by the program named by the shell option.

showmode (smd) noshowmode

Display a string in the status line showing the current mode. Display an * if the file has been modified.

sidescroll 16

The number of columns by which the screen is shifted left or right when leftright is true.

taglength (tl) 0

Defines number of characters that are significant for tags. Default (zero) means that all characters are significant.

tags (tag)

tags /var/db/libc.tags /sys/kern/tags

The list of possible tag files.

tildeop notildeop

The ~ command takes an associated motion, not just a preceding count.

wraplen (wl) 0

Identical to the wrapmargin option, except that it specifies the number of characters from the left margin at which the line will be split. The value of wrapmargin overrides wraplen.


elvis 2.2 Options

elvis 2.2 has a total of 225 options that affect its behavior. Table B.3, “elvis 2.2 set options” summarizes the most important ones. Most options described in Table B.1, “Solaris vi set options” are not repeated here.

Table B.3. elvis 2.2 set options

OptionDefaultDescription
autoiconify (aic) noautoiconify

Iconify the old window when de-iconifying a new one. X11 only.

backup (bk) nobackup

Make a backup file (xxx.bak) before writing the current file out to disk.

binary (bin)

The buffer’s data is not text. This option is set automatically.

boldfont (xfb)

The name of the bold font. X11 only.

bufdisplay (bd) normal

The default display mode for the buffer (hex, html, man, normal, syntax, or tex).

ccprg (cp) cc ($1?$1:$2)

The shell command for :cc.

directory (dir)

Where to store temporary files. The default is system-dependent.

display (mode) normal

The name of current display mode, set by the :display command.

elvispath (epath)

A list of directories in which to search for configuration files. The default is system-dependent.

focusnew (fn) focusnew

Force keyboard focus into the new window. X11 only.

font (fnt)

The name of the normal font, for the Windows and X11 interfaces.

gdefault (gd) nogdefault

Cause the substitute command to change all instances.

home (home) $HOME

The home directory for ~ in filenames.

italicfont (xfi)

The name of the italic font. X11 only.

locked (lock) nolocked

Make the buffer read-only and cause most commands that would modify the buffer to fail. Usually set automatically for read-only HTML files.

lpcolor (lpcl) nolpcl

Use color when printing; for :lpr.

lpcolumns (lpcols) 80

The width of a printer page; for :lpr.

lpcrlf (lpc) nolpcrlf

The printer needs CR/LF for newline in the file; for :lpr.

lpformfeed (lpff) nolpformfeed

Send a form feed after the last page; for :lpr.

lpheader (lph) nolph

Print a header at the top of the page; for :lpr.

lplines (lprows) 60

The length of a printer page; for :lpr.

lpout (lpo)

The printer file or filter, for :lpr. A typical value might be !lpr. The default is system-dependent.

lptype (lpt) dumb

The printer type, for :lpr. The value should be one of: ps, ps2, epson, pana, ibm, hp, cr, bs, dumb, html, or ansi.

lpwrap (lpw) lpwrap

Simulate line wrap; for :lpr.

makeprg (mp) make $1

The shell command for :make.

prefersyntax (psyn) never

Control use of syntax mode. Useful for HTML and manpages to show the input instead of the formatted contents. With a value of never, never use syntax mode. With writable, do so for writable files. With local, do so for files in the current directory. With always, always use syntax mode.

ruler (ru) noruler

Display the cursor’s line and column.

security (sec) normal

One of normal (standard vi behavior), safer (attempt to prevent writing malicious scripts), or restricted (try to make elvis safe for use as a restricted editor). In general, use the :safely command to set this; don’t do it directly.

showmarkups (smu) noshowmarkups

For the man and html modes, show the markup at the cursor position, but not elsewhere.

sidescroll (ss) 0

The sideways scrolling amount. Zero mimics vi, making lines wrap.

smartargs (sa) nosmartargs

Place the arguments for a function on the screen based on a tags file lookup after typing the function name and the function character (usually a left parenthesis).

spell (sp) nospell

Highlight misspelled words. This also works with programs, based on lookups in a tags file.

taglength (tl) 0

Defines the number of characters that are significant for tags. Default (zero) means that all characters are significant.

tags (tagpath) tags

The list of possible tag files.

tagstack (tsk) tagstack

Remember the origin of tag searches on a stack.

undolevels (ul) 0

The number of undoable commands. Zero mimics vi. You probably want to set this to a bigger number.

warpback (wb) nowarpback

Upon exit, move the pointer back to the xterm that started elvis. X11 only.

warpto (wt) don't

How ^W ^W forces pointer movement: don't for no movement, scrollbar moves the pointer to the scrollbar, origin moves the pointer to the upper left corner, and corners moves it to the corners furthest from and nearest to the current cursor position. This forces the X display to pan, to make sure the window is entirely onscreen.


Vim 7.1 Options

Vim 7.1 has a total of 295 (!) options that affect its behavior. Table B.4, “Vim 7.1 set options” summarizes the most important ones. Most options described in Table B.1, “Solaris vi set options” are not repeated here.

The summaries in this table are by necessity very brief. Much more information about each option may be found in the Vim online help.

Table B.4. Vim 7.1 set options

Option

Default

Description

autoread (ar) noautoread Detect whether a file inside Vim has been modified externally, not by Vim, and automatically refresh the Vim buffer with the changed version of the file.

background (bg)

dark or light

Vim tries to use background and foreground colors that are appropriate to the particular terminal. The default depends on the current terminal or windowing system.

backspace (bs)

0

Control whether you can backspace over a newline and/or over the start of insert. Values are: 0 for vi compatibility; 1 to backspace over newlines; and 2 to backspace over the start of insert. Using a value of 3 allows both.

backup (bk)

nobackup

Make a backup before overwriting a file, then leave it around after the file has been successfully written. To have a backup file just while the file is being written, use the writebackup option.

backupdir (bdir)

., ~/tmp/, ~/

A list of directories for the backup file, separated with commas. The backup file is created in the first directory in the list where this is possible. If empty, you cannot create a backup file. The name . (dot) means the same directory as where the edited file is.

backupext (bex)

~

The string that is appended to a filename to make the name of the backup file.

binary (bin)

nobinary

Change a number of other options to make it easier to edit binary files. The previous values of these options are remembered and restored when bin is switched back off. Each buffer has its own set of saved option values. This option should be set before editing a binary file. You can also use the -b command-line option.

cindent (cin)

nocindent

Enable automatic smart C program indenting.

cinkeys (cink)

0{,0},:,0#,!^F, o,O,e

A list of keys that, when typed in insert mode, cause reindenting of the current line. Only happens if cindent is on.

cinoptions (cino)

 

Affects the way cindent reindents lines in a C program. See the online help for details.

cinwords (cinw)

if, else, while, do, for, switch

These keywords start an extra indent in the next line when smartindent or cindent is set. For cindent this is done only at an appropriate place (inside {...}).

comments (com)

 

A comma-separated list of strings that can start a comment line. See the online help for details.

compatible (cp)

cp; nocp when a .vimrcfile is found

Makes Vim behave more like vi in too many ways to describe here. It is on by default, to avoid surprises. Having a .vimrc turns off the vi compatibility; usually this is a desirable side effect.

completeopt (cot) menu,preview A comma-separated list of options for insert mode completion.

cpoptions (cpo)

aABceFs

A sequence of single character flags, each one indicating a different way in which Vim will or will not exactly mimic vi. When empty, the Vim defaults are used. See the online help for details.

cursorcolumn (cuc) nocursorcolumn Highlight the screen column of the cursor with CursorColumn highlighting. This is useful for lining up text vertically. Can slow down screen display.
cursorline (cul) nocursorline Highlight the screen line of the cursor with CursorRow highlighting. Makes it easy to find the current line in the edit session. Use in conjunction with cursorcolumn for a crosshairs effect. Can slow down screen display.

define (def)

^#\s*define

A search pattern that describes macro definitions. The default value is for C programs. For C++, use ^\(#\s*define\ |[a-z]*\s*const\s*[a-z]*\). When using the :set command, you need to double the backslashes.

directory (dir)

., ~/tmp, /tmp

A list of directory names for the swap file, separated with commas. The swap file will be created in the first directory where this is possible. If empty, no swap file will be used and recovery is impossible! The name . (dot) means to put the swap file in the same directory as the edited file. Using . first in the list is recommended so that editing the same file twice will result in a warning.

equalprg (ep)

 

External program to use for = command. When this option is empty, the internal formatting functions are used.

errorfile (ef)

errors.err

Name of the error file for the quickfix mode. When the -q command-line argument is used, errorfile is set to the following argument.

errorformat (efm)

(Too long to print)

Scanf-like description of the format for the lines in the error file.

expandtab (et)

noexpandtab

When inserting a tab, expand it to the appropriate number of spaces.

fileformat (ff)

unix

Describes the convention to terminate lines when reading/writing the current buffer. Possible values are dos (CR/LF), unix (LF), and mac (CR). Vim usually sets this automatically.

fileformats (ffs)

dos,unix

List the line-terminating conventions that Vim tries to apply to a file when reading. Multiple names enable automatic end-of-line detection when reading a file.

formatoptions (fo)

Vim default: tcq; vi default: vt

A sequence of letters that describes how automatic formatting is to be done. See the online help for details.

gdefault (gd)

nogdefault

Cause the substitute command to change all instances.

guifont (gfn)

 

A comma-separated list of fonts to try when starting the GUI version of Vim.

hidden (hid)

nohidden

Hide the current buffer when it is unloaded from a window, instead of abandoning it.

history (hi)

Vim default: 20; vi default: 0

Control how many ex commands, search strings, and expressions are remembered in the command history.

hlsearch (hls)

nohlsearch

Highlight all matches of the most recent search pattern.

icon

noicon

Vim attempts to change the name of the icon associated with the window where it is running. Overridden by the iconstring option.

iconstring

 

String value used for the icon name of the window.

include (inc)

^#\s*include

Define a search pattern for finding include commands. The default value is for C programs.

incsearch (is)

noincsearch

Enable incremental searching.

isfname (isf)

@,48-57,/,.,-,_, +,,,$,:,~

A list of characters that can be included in file and path names. Non-Unix systems have different default values. The @ character stands for any alphabetic character. It is also used in the other is XXX options, described next.

isident (isi)

@,48-57,_,192-255

A list of characters that can be included in identifiers. Non-Unix systems may have different default values.

iskeyword (isk)

@,48-57,_,192-255

A list of characters that can be included in keywords. Non-Unix systems may have different default values. Keywords are used in searching and recognizing with many commands, such as w, [i, and many more.

isprint (isp)

@,161-255

A list of characters that can be displayed directly to the screen. Non-Unix systems may have different default values.

makeef (mef)

/tmp/vim##.err

The error file name for the :make command. Non-Unix systems have different default values. The ## is replaced by a number to make the name unique.

makeprg (mp)

make

The program to use for the :make command. % and # in the value are expanded.

modifiable (ma) modifiable When turned off, do not allow any changes in the buffer.

mouse

 

Enable the mouse in non-GUI versions of Vim. This works for MS-DOS, Win32, QNX pterm, and xterm. See the online help for details.

mousehide (mh)

nomousehide

Hide the mouse pointer during typing. Restores the pointer when the mouse is moved.

paste

nopaste

Change a large number of options so that pasting into a Vim window with a mouse does not mangle the pasted text. Turning it off restores those options to their previous values. See the online help for details.

ruler (ru)

noruler

Show the line and column number of the cursor position.

secure

nosecure

Disable certain kinds of commands in the startup file. Automatically enabled if you don’t own the .vimrc and .exrc files.

shellpipe (sp)

 

The shell string to use for capturing the output from :make into a file. The default value depends upon the shell.

shellredir (srr)

 

The shell string for capturing the output of a filter into a temporary file. The default value depends upon the shell.

showmode (smd)

Vim default: smd; vi default: nosmd

Put a message in the status line for insert, replace, and visual modes.

sidescroll (ss)

0

How many columns to scroll horizontally. The value zero puts the cursor in the middle of the screen.

smartcase (scs)

nosmartcase

Override the ignorecase option if the search pattern contains uppercase characters.

spell nospell Turn on spellchecking.

suffixes

*.bak,~,.o,.h,.info,.swp

When multiple files match a pattern during filename completion, the value of this variable sets a priority among them, in order to pick the one Vim will use.

taglength (tl)

0

Define number of characters that are significant for tags. Default (zero) means that all characters are significant.

tagrelative (tr)

Vim default: tr; vi default: notr

Filenames in a tags file from another directory are taken to be relative to the directory where the tags file is.

tags (tag)

./tags,tags

Filenames for the :tag command, separated by spaces or commas. The leading ./ is replaced with the full path to the current file.

tildeop (top)

notildeop

Make the ~ command behave like an operator.

undolevels (ul)

1000

The maximum number of changes that can be undone. A value of 0 means vi compatibility: one level of undo and u undoes itself. Non-Unix systems may have different default values.

viminfo (vi)

 

Read the viminfo file upon startup, and write it upon exiting. The value is complex; it controls the different kinds of information that Vim will store in the file. See the online help for details.

writebackup (wb)

writebackup

Make a backup before overwriting a file. The backup is removed after the file is successfully written, unless the backup option is also on.


vile 9.6 Options

vile 9.6 has 167 options (called “modes” in vile), which are denoted universal, buffer, or window modes according to their use. There are also 101 environment variables, which are more useful in scripts than for direct user manipulation.[75] Not all are available on every platform; some apply only to X11 or Win32.

Table B.5, “vile 9.6 set options” shows the compiled-in default values for the most important of vile’s options. The initialization scripts, such as vileinit.rc, override several of those values. Most options described in Table B.1, “Solaris vi set options” are not repeated here.

Table B.5. vile 9.6 set options

Option

Default

Description

alt-tabpos (atp) noatp

Controls whether the cursor sits at the left or right end of the whitespace representing a tab character.

animated animated

Automatically updates the contents of scratch buffers when their contents change.

autobuffer (ab) autobuffer

Uses “most-recently-used” style buffering; the buffers are sorted in order of use. Otherwise, buffers remain in the order in which they were edited.

autocolor (ac) 0

Automatic syntax coloring. If set to zero, automatic syntax coloring is disabled. Otherwise, it should be set to a small positive integer that represents the number of milliseconds to wait for a “quiet interval” before invoking the autocolor-hook hook.

autosave (as) noautosave

Automatic file saving. Writes the file after every autosavecnt characters of inserted text.

autosavecnt (ascnt) 256

Specifies after how many inserted characters automatic saves take place.

backspacelimit (bl) backspacelimit

If disabled, then in insert mode you can backspace past the point at which the insert began.

backup-style off

Controls how backup files are created when writing a file. Possible values are off, .bak for DOS-style backups, and tilde for Emacs-style hello.c~ backups under Unix.

bcolor default

Sets the background color on systems that support it.

byteorder-mark (bom) auto

Controls the check for a prefix used to distinguish different types of UTF encoding. The default value auto tells vile to inspect the file; specific values tell it to use that value.

check-modtime nocheck-modtime

Issues a “file newer than buffer” warning if the file has changed since it was last read or written, and prompts for confirmation.

cindent nocindent

Enable C-style indentation, which helps maintain current indentation level automatically during insert, like autoindent.

cindent-chars :#{}⁠(⁠ ⁠)[]

The list of characters interpreted by the cindent mode. These include # to indent to column 1, and : to indent further, as after a label. Listing a pair of characters that are also in fence-pairs causes text enclosed by the pair to be further indented.

cmode off

A built-in major mode for C code.

color-scheme (cs) default

Specify by name an aggregate of fcolor, bcolor, video-attrs, and $palette defined via the define-color-scheme command.

comment-prefix ^\s*\(\(\s*[#*>]\)\|\(///*\)\)\+

Describes the leading part of a line that should be left alone when reformatting comments. The default value is good for Makefile, shell and C comments, and email.

comments ^\s*/\?\(\s*[#*>/]\)\+/\?\s*$

A regular expression defining commented paragraph delimiters. Its purpose is to preserve paragraphs inside comments when reformatting.

cursor-tokens regex

Controls whether vile uses regular expressions or character classes for parsing tokens from the screen for various commands. This uses an enumeration: both, cclass, and regex.

dirc nodirc

vile checks each name when scanning directories for filename completion. This allows you to distinguish between directory names and filenames in the prompt.

dos nodos

Strips out the CR from CR/LF pairs when reading files, and puts them back when writing. New buffers for nonexistent files inherit the line style of the operating system, whatever the value of dos.

fcolor default

Sets the foreground color on systems that support it.

fence-begin /\*

Regular expressions for the start and end of simple non-nestable fences, such as C comments.

fence-end \*/
fence-if ^\s*#\s*if

Regular expressions marking the start, “else if”, “else”, and end of line-oriented, nested fences, such as C-preprocessor control lines.

fence-elif ^\s*#\s*elif\>
fence-else ^\s*#\s*else\>
fence-fi ^\s*#\s*endif\>
fence-pairs {}⁠(⁠ ⁠)[]

Each pair of characters denotes a set of “fences” that should be matched with %.

file-encoding auto

Specifies the character encoding of the buffer contents, e.g., one of 8bit, ascii, auto, utf-8, utf-16, or utf-32.

filtername (fn)

Specifies a syntax-highlighting filter, for a given major mode.

for-buffers (fb) mixed

Specifies whether globbing or regular expressions are used to select buffer names in the for-buffers and kill-buffer commands.

glob !echo %s

Controls how wildcard characters (e.g., * and ?) are treated in prompts for filenames. A value of off disables expansion, and on uses the internal globber, which can handle normal shell wildcards and ~ notation. The default value for Unix guarantees compatibility with your shell.

highlight (hl) highlight

Enables or disables syntax highlighting in the corresponding buffers.

history (hi) history

Logs commands from the colon command line (minibuffer) in the [History] buffer.

horizscroll (hs) horizscroll

Moving off the end of a long line shifts the whole screen sideways. If not set, only the current line shifts.

ignoresuffix (is) \(\.orig\|~\)$

Strips the given pattern from a filename before matching it for major mode suffixes.

linewrap (lw) nolinewrap

Wraps long logical lines onto multiple screen lines.

maplonger nomaplonger

The map facility matches against the longest possible mapped sequence, not the shortest.

meta-insert- bindings (mib) mib

Controls behavior of 8-bit characters during insert. Normally, key bindings are operational only when in command mode; when in insert mode, all characters are self-inserting. If this mode is on, and a metacharacter (i.e., a character with the eighth bit set) is typed that is bound to a function, then that function binding will be honored and executed from within insert mode. Any unbound metacharacters will remain self-inserting.

mini-hilite (mh) reverse

Defines the highlight attribute to use when the user toggles the editing mode in the minibuffer.

modeline nomodeline

Controls whether a vi-like mode line feature is enabled.

modelines 5

Controls the number of lines from each end of the buffer to scan for vi-like mode lines.

overlap-matches overlap-matches

Modifies the highlighting shown by visual-matches to control whether overlapping matches are shown.

percent-crlf 50

Percentage of total lines that must end with CR/LF for vile to automatically convert buffer’s recordseparator to crlf.

percent-utf8 90

Percentage of total characters that contain embedded nulls, making them look like UTF-16 or UTF-32 encodings. If the file-encoding option is set to auto and the match is higher than this threshold, vile will load the buffer data as UTF-8.

popup-choices (pc) delayed

Controls the use of a pop-up window for help in doing completion. The value is either off for no window, immediate for an immediate pop up, or delayed to wait for a second Tab key.

popup-msgs (pm) nopopup-msgs

When enabled, vile pops up the [Messages] buffer, showing the text that was written to the message line.

recordseparator (rs) lf [a]

Specify format of files that vile reads and writes. Formats are lf (for Unix), crlf (for DOS), cr (for Macintosh), and default (lf or crlf, depending on the platform).

resolve-links noresolve-links

If set, vile fully resolves filenames in case some path components are symbolic links. This helps avoid multiple unintentional edits of the same physical file via different pathnames.

ruler noruler

Shows the current line and column in the status line, as well as what percentage of the current buffer’s lines are in front of the cursor.

showchar (sc) noshowchar

Shows the value of the current character in the status line.

showformat (sf) foreign

Controls when/whether recordseparator information is shown in the status line. Values are: always, differs (to show when the local mode differs from the global), local (to show whenever a local mode is set), foreign (to show when the recordseparator differs from the native default), and never.

showmode (smd) showmode

Displays an indicator on the status line for insert and replace modes.

sideways 0

Controls by how many characters the screen scrolls to the left or right. The value of 0 moves the screen by one-third.

tabinsert (ti) tabinsert

Allows the physical insertion of tab characters into the buffer. If turned off (notabinsert), vile will never insert a tab into a buffer; instead it will always insert the appropriate number of spaces.

tagignorecase (tc) notagignorecase

Makes tag searches ignore case.

taglength (tl) 0

Defines the number of characters that are significant for tags. Default (zero) means that all characters are significant. This does not affect tags picked up from the cursor; they are always matched exactly. (This is different from the other editors).

tagrelative (tr) notagrelative

When using a tags file in another directory, filenames in that tags file are considered to be relative to the directory where the tags file is.

tags tags

A space-separated list of files in which to look up tag references.

tagword (tw) notagword

Use the whole word under the cursor for the tag lookup, not just the subword starting at the current cursor position.

undolimit (ul) 10

Limits how many changes may be undone. The value zero means “no limit.”

unicode-as-hex (uh) nounicode-as-hex

If displaying a buffer whose file encoding says it is one of the Unicode flavors (e.g., utf-8, utf-16, or utf-32), shows the values that are non-ASCII in \uXXXX format even if the display is capable of showing these as regular characters.

unprintable-as- octal (uo) nounprintable-as-octal

Displays nonprinting characters with the eighth bit set in octal. Otherwise, uses hexadecimal. Nonprinting characters whose eighth bit is not set are always displayed in control character notation.

visual-matches none

Controls highlighting of all matching occurrences of a search pattern. The possible values are none for no highlighting, or underline, bold, and reverse for those kinds of highlighting. Colors may also be used on systems that support it.

xterm-fkeys noxterm-fkeys

Supports xterm’s modified function keys by generating system bindings for the Shift-, Ctrl-, and Alt- modifiers of each function key listed in the terminal description.

xterm-mouse noxterm-mouse

Allows use of the mouse from inside an xterm. See the online help for details.

xterm-title noxterm-title

Enables title bar updates if you are running within an xterm. Each time you switch to a different buffer, vile can update the title. This uses the same tests of the TERM variable as the xterm-mouse mode.

[a] This depends on the platform for which vile is compiled.




[75] These include variables that are set or used as a side effect of other commands. Owing to their focus on scripting, their descriptions are also not suitable for this table since they tend to be lengthy—read the online help for details.

If you enjoyed this excerpt, buy a copy of Learning the vi and Vim Editors, Seventh Edition.

Copyright © 2009 O'Reilly Media, Inc.