17.5. Local Settings for viIn addition to reading the .exrc file (the vi configuration or startup file) in your home directory, many versions of vi will read a file called .exrc in the current directory. This allows you to set options that are appropriate to a particular project. For example, you might want to have one set of options in a directory used mainly for programming: set number lisp autoindent sw=4 terse set tags=/usr/lib/tags and another set of options in a directory used for text editing: set wrapmargin=15 ignorecase Note that you can set certain options in the .exrc file in your home directory (Section 1.15) and unset them (for example, set wrapmargin=0 noignorecase) in a local directory. NOTE: Many versions of vi don't read .exrc files in the current directory unless you first set the exrc option in your home directory's .exrc file:set exrc You can also define alternate vi environments by saving option settings in a file other than .exrc and reading in that file with the :so command. For example: :so .progoptions Local .exrc files are also useful for defining abbreviations ( Section 17.23) and key mappings (Section 18.2). When we write a book or manual, we save all abbreviations to be used in that book in an .exrc file in the directory in which the book is being created. You can also store settings and startup commands for vi and ex in an environment variable called EXINIT (Section 17.27). If there is a conflict between settings in EXINIT and an .exrc file, EXINIT settings take precedence. NOTE: You can keep a group of standard .exrc files in a central directory and link (Section 10.5) to them from various local directories. For instance, from this book's source-file directory, which is full of SGML files, I made a symlink:% ln -s ~/lib/vi/exrc.sgml .exrc -- TOR Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|