[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 10 Editors

10.1 Configuring Your vi Session


To configure the vi environment certain options can be set with the line editor command :set during a vi editing session. Alternatively, frequently used options can be set automatically when vi is invoked, by use of the .exrc file. This file can also contain macros to map keystrokes into functions using the map function. Within vi these macros can be defined with the :map command. Control characters can be inserted by first typing <control>-V (^V), then the desired control character. The options available in vi include, but are not limited to, the following. Some options are not available on every Unix system.

:set all display all option settings

:set ignorecase ignore the case of a character in a search

:set list display tabs and carriage returns

:set nolist turn off list option

:set number display line numbers

:set nonumber turn off line numbers

:set showmode display indication that insert mode is on

:set noshowmode turn off showmode option

:set wrapmargin=n turn on word-wrap n spaces from the right margin

:set wrapmargin=0 turn off wrapmargin option

:set warn display "No write since last change"

:set nowarn turn off "write" warning

The following is a sample .exrc file:

set wrapmargin=10

set number

set list

set warn

set ignorecase

map K {!}fmt -80 # reformat this paragraph, {!}, using fmt to 80 characters per line

map ^Z :!spell # invoke spell, :!, to check a word spelling (return to vi with ^D)


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]