The .exrc file ( 4.9 ) can set vi options for all files - or for files in a certain directory ( 30.6 ) . The articles listed below show other ways to set your vi setup.
A controversial feature because of security problems, modelines ( 30.19 ) are still handy if you use them carefully. They let you store setup commands for each file, in the file itself.
Instead of modelines, you can make separate setup files for each file you want to edit. These don't have the security problems of modelines because you can make the setup files read-only. See article 30.21 .
Article 30.20 lets you choose any one of a number of setups by typing a setup-choosing command from the shell prompt. All vi commands you start afterwards will use that setup. You can start a new setup any time.
-