reading of local .exrc files

jerryp at tektronix.UUCP jerryp at tektronix.UUCP
Thu May 17 19:39:12 AEST 1984


Like many people, I want different vi options set for writing a program
than for working on a text file.  Here's how I do it:

Instead of putting mode lines within each file, or writing extensions to
the filenames, I've got several different .exrc files... one for each vi mode
I'd like to use.  I have aliases 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 .cshrc file:
-----------------------------------

    setenv EXSTAT "text"	# initialization for 'vi' alias

	    #---- THESE ALIASES RESET THE .exrc FILE ----#
    # SET 'vi' FOR 4-CHARACTER TABS/SHIFTS (RING BELL AS REMINDER):
    alias 4vi 'cp ~/.exrc4 ~/.exrc; setenv EXSTAT "programming^G"'

    # SET 'vi' FOR 8-CHARACTER TABS/SHIFTS:
    alias 8vi 'cp ~/.exrc8 ~/.exrc; setenv EXSTAT "text"'

    # SET 'vi' FOR QUICK WORK ON BUSY SYSTEM (NO .exrc FILE):
    alias qvi 'rm ~/.exrc; setenv EXSTAT "quick"'

	    #---- THESE ARE THE vi ALIASES.  ONE SETS THE vi MODE FIRST ----#
    # show whether using ~/.exrc4 or ~/.exrc8:
    alias vi 'echo "MODE: "$EXSTAT; /usr/ucb/vi \!*'

    # call 'vi' with a search
    # (must use 8vi because search requires a 'wrapscan', and .exrc8 has ws set)
    alias vs '8vi; vi +/\!*'

-----------------------------------

The $EXSTAT variable remembers which .exrc? file (.exrc4, .exrc8) has been
copied into the .exrc file.  Also, as was mentioned in another unix-wizards
article, 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".

(Please direct all flames about BSD and C-shell to /dev/null.)

--Jerry Peek, Tektronix, Inc.
US Mail:   MS 76-036, P.O. Box 500, Beaverton, OR 97077
uucp:      {allegra,decvax,hplabs,ihnp4,mit-eddie,ucbvax}!tektronix!jerryp
CSnet:     jerryp at tek
ARPAnet:   jerryp.tek at csnet-relay
Phone:     503/627-1603



More information about the Comp.unix.wizards mailing list