Path: utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!uw-beaver!sumax!thebes!quick!cjsa!jeff From: jeff@cjsa.wa.com (Jeffery Small) Newsgroups: comp.editors Subject: Re: vi .exrc files Message-ID: <1990Oct22.214502.24966@cjsa.wa.com> Date: 22 Oct 90 21:45:02 GMT References: <6009@minyos.xx.rmit.oz> <1748@b15.INGR.COM> Distribution: comp Organization: C. Jeffery Small and Associates Lines: 64 rob@b15.INGR.COM (Rob Lemley) writes: >In <6009@minyos.xx.rmit.oz> (Stephen Riehm [Romulis]) writes: >>Is there any way of getting vi to :- >>b> read its .exrc file from a different directory?? >On system V release 3 UNIX, vi will read the $HOME/.exrc file first, >then the .exrc file in the current directory. > >-Rob Lemley 205-730-1546 > System Consultant, Scanning Software, Intergraph, Huntsville, AL If set, vi will first attempt to use the environment variable $EXINIT before resorting to the .exrc file(s). Depending upon what I am logged into and where (which machine) I am currently on, I want to use a different vi initialization file. (I use this scheme to try and set every keyboard I work on to function in a similar manner.) I keep a set of vi initialization files in the directory $HOME/.misc such as: $HOME/.misc/.exrcSUN $HOME/.misc/.exrc3B1 $HOME/.misc/.exrcWY75 $HOME/.misc/.exrcVT100 etc. Here is a skeleton outline from my $HOME/.profile which shows how these files can be used. This should give you the general idea of how to set things up. This scheme has worked just fine for me. In addition to use in .profile, you can of course also set and use the EXINIT variable interactively. Note: 'so' is the ex source command which says to execute the ex commands in the named file. # $HOME/.profile ... EDITOR=/usr/bin/vi ... case `tty` in /dev/w*|/dev/syscon) EXINIT='so $HOME/.misc/.exrc3B1' ; export EXINIT ;; /dev/ttyp*) case $TERM in s4|unixpc) EXINIT='so $HOME/.misc/.exrc3B1' ; export EXINIT ;; sun) EXINIT='so $HOME/.misc/.exrcSUN' ; export EXINIT ;; wy75) EXINIT='so $HOME/.misc/.exrcWY75' ; export EXINIT ;; vt100) EXINIT='so $HOME/.misc/.exrcVT100' ; export EXINIT ;; *) echo ".profile: Unrecognized terminal type <${TERM}>." ;; esac ;; /dev/tty001) EXINIT='so $HOME/.misc/.exrcWY75' ; export EXINIT ;; /dev/tty002) EXINIT='so $HOME/.misc/.exrc3B1' ; export EXINIT ;; *) echo ".profile: Unrecognized login port <`tty`>." ;; esac