Appendix A. vi Commands Quick Reference

This appendix lists vi commands and ex commands according to their use.

Table A.1. Movement Commands

Command Function
Character  
h,j,k,l Left, down, up, right (Figure , Figure , Figure , Figure ).
Text  
w,W,b,B Forward, backward by word.
e,E End of word.
),( Beginning of next, previous sentence.
},{ Beginning of next, previous paragraph.
]],[[ Beginning of next, previous section.
Lines  
RETURN First non-blank character of next line.
0, $ First, last position of current line.
^ First non-blank character of current line.
+, - First non-blank character of next, previous line.
n| Column n of current line.
H Top line of screen.
M Middle line of screen.
L Last line of screen.
nH n (number) of lines after top line.
nL n (number) of lines before last line.
Scrolling  
CTRL-F, CTRL-B Scroll forward, backward one screen.
CTRL-D, CTRL-U Scroll down, up one-half screen.
CTRL-E, CTRL-Y Show one more line at bottom, top of window.
z RETURN Reposition line with cursor: to top of screen.
z. Reposition line with cursor: to middle of screen.
z- Reposition line with cursor: to bottom of screen.
CTRL-L Redraw screen (without scrolling).
Searches  
/pattern Search forward for pattern.
?pattern Search backward for pattern.
n, N Repeat last search in same, opposite direction.
/, ? Repeat previous search forward, backward.
fx Search forward for character x in current line.
Fx Search backward for character x in current line.
tx Search forward to character before x in current line.
Tx Search backward to character after x in current line.
; Repeat previous current-line search.
, Repeat previous current-line search in opposite direction.
Line number  
CTRL-G Display current line number.
nG Move to line number n.
G Move to last line in file.
:n Move to line n in file.
Marking position  
mx Mark current position as x.
`x Move cursor to mark x.
` ` Return to previous mark or context.
'x Move to beginning of line containing mark x.
'' Return to beginning of line containing previous mark.

Table A.2. Editing Commands

Command Function
Insert  
i, a Insert text before, after cursor.
I, A Insert text before beginning, after end of line.
o, O Open new line for text below, above cursor.
Change  
r Replace character.
cw Change word.
cc Change current line.
cmotion

Change text between the cursor and the target of motion.

C Change to end of line.
R Type over (overwrite) characters.
s Substitute: delete character and insert new text.
S Substitute: delete current line and insert new text.
Delete, move  
x Delete character under cursor.
X Delete character before cursor.
dw Delete word.
dd Delete current line.
dmotion

Delete text between the cursor and the target of motion.

D Delete to end of line.
p, P Put deleted text after, before cursor.
"np

Put text from delete buffer number n after cursor (for last nine deletions).

Yank  
yw Yank (copy) word.
yy Yank current line.
"ayy

Yank current line into named buffer a (a-z). Uppercase names append text.

ymotion

Yank text between the cursor and the target of motion.

p, P Put yanked text after, before cursor.
"aP Put text from buffer a before cursor (a-z).
Other commands  
. Repeat last edit command.
u, U Undo last edit; restore current line.
J Join two lines.
ex edit commands  
:d Delete lines.
:m Move lines.
:co or :t Copy lines.
:.,$d Delete from current line to end of file.
:30,60m0 Move lines 30 through 60 to top of file.
:.,/pattern/co$

Copy from current line through line containing pattern to end of file.

Table A.3. Exit Commands

Command Function
ZZ Write (save) the file if modified, and quit file.
:x Write (save) the file if modified, and quit file.
:wq Write (save) the file unconditionally, and quit file.
:w Write (save) file.
:w! Write (save) file, overriding protection.
:30,60w newfile Write from line 30 through line 60 as newfile.
:30,60w>> file

Write from line 30 through line 60 and append to file.

:w %.new Write current buffer named file as file.new.
:q Quit file.
:q! Quit file, overriding protection.
Q Quit vi and invoke ex.
:e file2 Edit file2 without leaving vi.
:r newfile

Read contents of newfile into current file.

:n Edit next file.
:e! Return to version of current file at time of last write (save).
:e # Edit alternate file.
:vi Invoke vi editor from ex.
: Invoke one ex command from vi editor.
% Current filename (substitutes into ex command line).
# Alternate filename (substitutes into ex command line).

Table A.4. Solaris vi Command Mode Tag Commands

Command Function
^]

Look up the location of the identifier under the cursor in the tags file, and move to that location. If tag stacking is enabled, the current location is automatically pushed onto the tag stack.

^T

Return to the previous location in the tag stack, i.e., pop off one element.

Table A.5. Command-Line Options

Command Function
vi file

Invoke vi editor on file.

vi file1 file2 Invoke vi editor on files sequentially.
view file

Invoke vi editor on file in read-only mode.

vi -R file Invoke vi editor on file in read-only mode.
vi -r file

Recover file and recent edits after a crash.

vi -t tag

Look up tag and start editing at its definition.

vi -w n

Set the window size to n; useful over a slow connection.

vi + file Open file at last line.
vi +n file

Open file directly at line number n.

vi -c command file

Open file, execute command, which is usually a search command or line number (POSIX).

vi +/pattern file

Open file directly at pattern.

ex file Invoke ex editor on file.
ex - file < script

Invoke ex editor on file, taking commands from script; suppress informative messages and prompts.

ex -s file < script

Invoke ex editor on file, taking commands from script; suppress informative messages and prompts (POSIX).

Table A.6. Other ex Commands

Command Function
Abbreviations [63]  
:map x sequence

Define keystroke x as a command sequence. x can be multiple characters.

:map! x sequence

Define x as command sequence for insert mode.

:unmap x Disable the map x.
:unmap! x Disable the insert mode map x.
:ab abbr phrase

Abbreviate phrase as abbr; when abbr is typed in insert mode, it expands to full words or phrases.

:unab abbr Disable abbreviation abbr.
Customizing environment: [63]  
:set option Activate option.
:set option=value

Assign value to option.

:set nooption Deactivate option.
:set Display options set by user.
:set all

Display list of all current option settings, both default and those set by the user.

:set option? Display value of option.
Accessing UNIX  
:sh Invoke shell.
^D Return to editor from shell.
:! command Give UNIX command.
:n,m! command

Filter lines n to m through UNIX command.

:r !command

Read output of UNIX command into current file.

[63]In .exrc files, omit the colon at the start of ex commands.


Appendix B. ex Commands

Contents:

Command Syntax
Alphabetical List of Commands

This appendix describes the syntax of ex commands and then presents an alphabetical list of ex commands.

B.1. Command Syntax

To enter an ex command from vi, use this form:

:[address]command[options]

address is the line number or range of lines that are the object of command. If no address is given, the current line is (usually) the object of the command.

B.1.1. Address Symbols

In ex command syntax, address can be specified in any of the forms shown in Table B.1.

Table B.1. ex Address Syntax

Address Includes
1,$ All lines in the file
x,y Lines x through y
x;y

Lines x through y, with current line reset to x

0 Top of file
. Current line
n Absolute line number n
$ Last line
% All lines; same as 1,$
x-n n lines before x
x+n n lines after x
-[n] One or n lines previous
+[n] One or n lines ahead
'x Line marked with x
'' Previous mark
/pat/ or ?pat? Ahead or back to line where pat matches

B.1.2. Option Symbols

In ex command syntax, options might be any of the following:

!

Indicates a variant form of the command, overriding the normal behavior.

count
The number of times the command is to be repeated. count cannot precede the command, because a number preceding an ex command is treated as a line address. d3 deletes three lines beginning with the current line; 3d deletes line 3.

file
The name of a file that is affected by the command. % stands for current file; # stands for previous file.


Appendix C. Setting Options

Contents:

Solaris 2.6 vi Options
nvi 1.79 Options
elvis 2.0 Options
vim 5.1 Options
vile 8.0 Options

This appendix describes the important set command options for Solaris 2.6 vi, nvi 1.79, elvis 2.0, vim 5.1, and vile 8.0.

C.1. Solaris 2.6 vi Options

Table C.1 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 C.1. Solaris 2.6 vi Set Options

Option Default Description
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

Displays changes after each editor command. (For global replacement, displays last replacement.)

autowrite (aw) noaw

Automatically writes (saves) the file if changed before opening another file with :n or before giving UNIX command with :!.

beautify (bf) nobf

Ignores all control characters during input (except tab, newline, or formfeed).

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 actual version of ed actually behaved this way.

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

Allows the execution of .exrc files that reside outside the user's home directory.

hardtabs (ht) 8

Defines boundaries for terminal hardware tabs.

ignorecase (ic) noic

Disregards case during a search.

lisp nolisp

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

list nolist

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

magic magic

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

mesg mesg

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

novice nonovice

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

number (nu) nonu

Displays line numbers on left of screen during editing session.

open open

Allows entry to open or visual mode from ex. Although not in Solaris 2.6 vi, this option has traditionally been in vi, and may be in your UNIX's version of vi.

optimize (opt) noopt

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

paragraphs (para)

IPLPPPQP LIpplpipbp

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

prompt prompt

Displays the ex prompt (:) when vi's Q command is given.

readonly (ro) noro

Any writes (saves) of a file will 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

Allows nested map sequences.

report 5

Displays 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 [Figure window]

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

sections (sect) SHNHH HU

Defines 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

Defines 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, rings the error message bell.) Very useful for programming.

showmode noshowmode

In insert mode, displays a message on the prompt line indicating the type of insert you are making. For example, "OPEN MODE," or "APPEND MODE."

slowopen (slow)

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

tabstop (ts) 8

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

taglength (tl) 0

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

tags

tags /usr/lib/tags

Defines 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

Enables stacking of tag locations on a stack.

term Sets terminal type.
terse noterse

Displays shorter error messages.

timeout (to) timeout

Keyboard maps time out after 1 second.[64]

ttytype

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

warn warn

Displays the warning message, "No write since last change."

window (w)

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

wrapscan (ws) ws

Searches wrap around either end of file.

wrapmargin (wm) 0

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

writeany (wa) nowa Allows saving to any file.

[64] 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 1 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.

C.2. nvi 1.79 Options

nvi 1.79 has a total of 78 options that affect its behavior. Table C.2 summarizes the most important ones. Most options described in Table C.1 are not repeated here.

Table C.2. nvi 1.79 Set Options

Option Default Description
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. For example, a value of "N%.bak" causes nvi to include a version number at the end of the file; version numbers are always incremented.

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 RETURN 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 non-empty 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 a also 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

Displays 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

Turns off access to external programs via text filtering (:r!, :w!), disables 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

Displays a string in the status line showing the current mode. Displays 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.

C.3. elvis 2.0 Options

elvis 2.0 has a total of 144 options that affect its behavior. Table C.3 summarizes the most important ones. Most options described in Table C.1 are not repeated here.

Table C.3. elvis 2.0 Set Options

Option Default Description
autoiconify (aic) noautoiconify

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

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.

bufdisplay (bd) normal

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

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

The shell command for :cc.

commentfont (cfont)

The name of the font used for comments.

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.

functionfont (ffont)

The name of the font used for function names.

gdefault (gd) nogdefault

Causes the substitute command to change all instances.

home (home) $HOME

The home directory for ~ in filenames.

italicfont (xfi)

The name of the italic font.

keywordfont (kfont)

The name of the font used for reserved words.

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.

lplines (lprows) 60

The length of a printer page; for :lpr.

lppaper (lpp) letter

The paper size (letter, a4, ...) for PostScript printers; 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, or dumb.

lpwrap (lpw) lpwrap

Simulate line-wrap; for :lpr.

makeprg (mp) make $1

The shell command for :make.

normalfont (xfn)

The name of the normal font.

otherfont (ofont)

The font used for other symbols.

prepfont (pfont)

The font used for preprocessor commands.

ruler (ru) noruler

Display the cursor's line and column.

safer (trapunsafe) nosafer

Be paranoid; use the :safer 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.

stringfont (sfont)

The font used for strings.

taglength (tl) 0

Defines 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.

variablefont (vfont)

The font used for variables.

warpback (wb) nowarpback

Upon exit, move the pointer back to the xterm which started elvis.

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.

C.4. vim 5.1 Options

vim 5.1 has a total of 170 options that affect its behavior. Table C.4 summarizes the most important ones. Most options described in Table C.1 are not repeated here.

The summaries in the table here are of necessity very brief. Much more information about each option may be found in the vim online help.

Table C.4. vim 5.1 Set Options

Option

Default

Description

background (bg)

dark or light

vim tries to use background and foreground colors that are appropriate to the particular terminal.

backspace (bs)

0

Controls 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 will be 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 which is appended to a file name to make the name of the backup file.

binary (bin)

nobinary

Changes 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

Enables 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 only done 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 .vimrc file 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.

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 on-line help for details.

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 errorfile 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 will usually set this automatically.

fileformats (ffs)

dos,unix

Lists the line-terminating conventions that vim will try 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 which describes how automatic formatting is to be done. See the online help for details.

gdefault (gd)

nogdefault

Causes 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

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

hlsearch (hls)

nohlsearch

Highlight all matches of the most recent search pattern.

history (hi)

vim default: 20, vi default: 0

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

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

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

incsearch (is)

noincsearch

Enables 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 isXXX options, below.

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 errorfile 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.

mouse

 

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

mousehide (mh)

nomousehide

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

paste

nopaste

Changes 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

Shows the line and column number of the cursor position.

secure

nosecure

Disables 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

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

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 actually use.

taglength (tl)

0

Defines 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, i.e., add the colon and put the whole thing in courier, separated by spaces or commas. The leading ./ is replaced with the full path to the current file.

tildeop (top)

notildeop

Makes 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)

 

Reads the viminfo file upon startup and writes 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 was successfully written, unless the backup option is also on.

C.5. vile 8.0 Options

vile 8.0 has a total of 92 options that affect its behavior. Table C.5 summarizes the most important ones. Most options described in Table C.1 are not repeated here.

Table C.5. vile 8.0 Set Options

Option

Default

Description

alt-tabpos

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 would 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.

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 for no backups, .bak for DOS style backups, and tilde for emacs style hello.c~ backups under UNIX.

bcolor

 

Sets the background color on systems that support it.

check-modtime

nocheck-modtime

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

cmode

off

A built-in major mode for C code.

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.

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 non-existent files inherit the line-style of the operating system, whatever the value of dos.

fcolor

 

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 expression 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 %.

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.

history (hi)

history

Logs commands from the colon command line 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.

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)

nomib

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

mini-edit

^G

The character that toggles the editing mode in the minibuffer.

mini-hilite (mh)

reverse

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

popup-choices (pc)

delayed

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

preamble (pre)

 

A regular expression describing the first line of filenames for which the corresponding major mode will be set.

resolve-links

noresolve-links

If set, vile fully resolves filenames in cases where 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 lie in front of the cursor.

showmode (smd)

noshowmode

Display an indicator on the modeline for insert and replace modes.

sideways

0

Prompts for a new value for the sideways scroll offset, which controls by how many characters the screen scrolls to the left or right. The value of 0 moves the screen by one third.

suffixes (suf)

 

A regular expression describing filenames for which the corresponding major mode will be set. Used as part of the major mode facility, not by itself.

tabinsert (ti)

tabinsert

Allow 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 number of characters that are significant for tags. Default (zero) means that all characters are significant. This does not effect tags picked up from the cursor, they are always matched exactly. (This is different from the other editors.)

tagrelative (tr)

tagrelative

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

Uses the whole word under the cursor for the tag lookup, not just the sub-word starting at the current cursor position.

undolimit (ul)

10

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

unprintable-as-octal (uo)

nounprintable-as-octal

Displays non-printing characters with the eighth bit set in octal. Otherwise, uses hexadecimal. Non-printing 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-mouse

noxterm-mouse

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


Copyright © 2003 O'Reilly & Associates. All rights reserved.