7.0 - Setting up .exrc file

Any commands that can be used in command input mode ( : commands), may be used in a .exrc, which will load automatically whenever you start vi. In addition, the source command (so), abbreviations (ab), and macros may be used. There may not be any blank lines in your .exrc. A " in the first column may be used to tell vi that what follows is a comment.

7.1 - Sample .exrc file

This .exrc file is a real one. Mine. Because of that, it doesn't set as many options as one might wish it did to get a good idea of what may be used. However, it should get the basic idea down, and it is quite straightforward.

set wm=3
set sm
" abbreviations for my email address.
ab zidllem E. Larry Lidz - ellidz@midway
ab zidlleu E. Larry Lidz - ellidz@midway.uchicago.edu
map V :w^M:!ispell -x %^M:e!^M^M

First, note that you do not need to specify the :, it is assumed.

The first line, set wm=3 sets the warpmargin to be three characters from the right of the screen. This gives me a nice wordwrap.

The second line sets showmatch so that whenever I type a }, ) or ], it shows the matching brace, parenthesis, or bracket. This is useful for the programming I do.

The third line sets an abbreviation so that whenever I type zidllem as a word by itself it expands to my name and email address. The fourth is similar except that it gives the whole address, not just the local one.

The fifth line sets V to automatically run ispell on the current document passing it the -x parameter so that it doesn't save any backups. (I don't like filling my directories with useless backups.)

This HTML version of the vi Faq was compiled by Baruch Promislow of Macom Networking LTD.

(C)opyright, E. Larry Lidz, 1994, 1995. All Rights Reserved.