[This article shows vi, but the same thing will work for other editors that read a setup file when they start up. -JP]
Instead of puttingwithin each file, or writing , I've got several different startup files... one for each vi mode I'd like to use. I have that let me select the .exrc file I want. And I have vi aliased so that, when I start it up, it tells me which .exrc file is in use. Here are the lines (with comments) from my file (the CD-ROM has a set for Bourne-type shells):
setenv EXSTAT text # INITIALIZATION FOR 'vi' ALIAS # -- THESE ALIASES RESET THE .exrc FILE -- # # SET 'vi' FOR 4-CHARACTER TABS/SHIFTS: alias 4vi 'cp ~/lib/vi/exrc4 ~/.exrc; setenv EXSTAT programming' # SET 'vi' FOR 8-CHARACTER TABS/SHIFTS: alias 8vi 'cp ~/lib/vi/exrc8 ~/.exrc; setenv EXSTAT text' # SET 'vi' FOR QUICK WORK WHEN SYSTEM IS SLOW (NO .exrc FILE): alias qvi 'rm ~/.exrc; setenv EXSTAT quick' # -- THESE ARE THE vi ALIASES. ONE SETS THE vi MODE FIRST -- # alias vi 'echo "MODE: $EXSTAT"; sleep 1; /usr/ucb/vi \!*' # CALL vi WITH A SEARCH: alias vs '8vi; vi +/\!*'
The EXSTAT variable remembers which setup file has been stored in
the .exrc file. Also, because
you can't start vi with a search (
vi +/PATTERN) unless
the wrapscan option has been set... so, I start the vs
alias with an
8vi because my exrc8 file sets wrapscan.
Here's an example. I'll edit the file report and search for a line
that has the word misteak:
vs misteak reportMODE: text "report" 45 lines, 2734 characters