[comp.bugs.sys5] vi exrc behaviour has changed??!!

mellman@ttrde.UUCP (Thomas Mellman) (02/05/88)

It appears that vi's behaviour has changed with regards to its .exrc files.

I used to (prior to sysV R3) keep my basic set of vi options
and macros in the EXINIT variable, and more specific macros in particular
directories.  For example, in directories where I do C work, I have a
.exrc file tailored for that kind of work, and in my documentation
directories, I have a different .exrc file.

This has been a practical way to handle a limited number of special function
keys, and limited amount of macro space.

Now that we are moving to a R3 machine, I find that if I have the EXINIT
variable set, no further .exrc file reading takes place.  Furthermore,
even when the EXINIT variable is not set, only the .exrc file in my home
directory is read.

It seems that somebody decided that since he didn't use the old .exrc
feature, nobody else did either, and just quietly lopped it off.  I am
disappointed.

cher@whutt.UUCP (Mike Cherepov) (02/07/88)

In article <329@ttrde.UUCP>, mellman@ttrde.UUCP (Thomas Mellman) writes:
> It appears that vi's behaviour has changed with regards to its .exrc files.
> This has been a practical way to handle a limited number of special function
> keys, and limited amount of macro space.
> Now that we are moving to a R3 machine, I find that if I have the EXINIT
> variable set, no further .exrc file reading takes place.  Furthermore,
> even when the EXINIT variable is not set, only the .exrc file in my home
> directory is read.
> It seems that somebody decided that since he didn't use the old .exrc
> feature, nobody else did either, and just quietly lopped it off.  I am
> disappointed.

Relax - the feature is still there (according to the specs doc, anyhow, I
haven't tried it). Just modify your $HOME/.exrc file to include the line:
set exrc
that should restore the functionality. Alternatively, you can try "set exrc"
with EXINIT. And, surprise, there was a VERY good reason for this change, but
I am reluctant to discuss it here. Good luck...
		Mike Cherepov
		[ihnp4!]whutt!cher

fmr@cwi.nl (Frank Rahmani) (02/09/88)

In article <2853@whutt.UUCP>, cher@whutt.UUCP (Mike Cherepov) writes:
> In article <329@ttrde.UUCP>, mellman@ttrde.UUCP (Thomas Mellman) writes:
> > It appears that vi's behaviour has changed with regards to its .exrc files.
> > This has been a practical way to handle a limited number of special function
> > keys, and limited amount of macro space.
> > Now that we are moving to a R3 machine, I find that if I have the EXINIT
> > variable set, no further .exrc file reading takes place.  Furthermore,
> > even when the EXINIT variable is not set, only the .exrc file in my home
> > directory is read.
If EXINIT is set no $HOME/.exrc file will be read. To tell vi to read
other files on startup,
include a line:
so '//full/pathname/of/file/to/be/read/'
in $HOME/.exrc e.g.
so '//usr/local/scripts/.exrc'
to read a systemwide .exrc file. This works for me anyway.
fmr@cwi.nl

-- 
It is better never to have been born. But who among us has such luck?
----- News saved at 9 Feb 88 08:22:25 GMT
In article <2853@whutt.UUCP>, cher@whutt.UUCP (Mike Cherepov) writes:
> In article <329@ttrde.UUCP>, mellman@ttrde.UUCP (Thomas Mellman) writes:
> > It appears that vi's behaviour has changed with regards to its .exrc files.
> > This has been a practical way to handle a limited number of special function
> > keys, and limited amount of macro space.
> > Now that we are moving to a R3 machine, I find that if I have the EXINIT
> > variable set, no further .exrc file reading takes place.  Furthermore,
> > even when the EXINIT variable is not set, only the .exrc file in my home
> > directory is read.
If EXINIT is set no $HOME/.exrc file will be read. To tell vi to read
other files on startup,
include a line:
so '//full/pathname/of/file/to/be/read/'
in $HOME/.exrc e.g.
so '//usr/local/scripts/.exrc'
to read a systemwide .exrc file. This works for me anyway.
fmr@cwi.nl

-- 
It is better never to have been born. But who among us has such luck?

paul@whuts.UUCP (HO) (02/11/88)

In article <329@ttrde.UUCP>, mellman@ttrde.UUCP (Thomas Mellman) writes:
> It appears that vi's behaviour has changed with regards to its .exrc files.
> 
> It seems that somebody decided that since he didn't use the old .exrc
> feature, nobody else did either, and just quietly lopped it off.  I am
> disappointed.

vi searching .exrc file in the current directory is a dubious
idea for security reason. Some Bell Labs 452 UNIX have disabled this
feature. Didn't you say SVR3 also disables this feature, if so,
good. At the same time, I can see your need for your application, but
it is not an insurmountable one.

	Paul Ho
 

rbutterworth@watmath.waterloo.edu (Ray Butterworth) (02/11/88)

In article <3728@whuts.UUCP>, paul@whuts.UUCP (HO) writes:
> vi searching .exrc file in the current directory is a dubious
> idea for security reason. Some Bell Labs 452 UNIX have disabled this
> feature. Didn't you say SVR3 also disables this feature, if so,
> good. At the same time, I can see your need for your application, but
> it is not an insurmountable one.

Actually, I'd like to see the current behaviour of .exrc changed
to yet a third possibility.

VI should not look in the current directory.
It should look in the directory containing the file being edited.

If I have a file with non-standard tabstops, I'll put the "set tabstop="
command into a .exrc file in that file's directory.  Similarly, if I
have a file that I don't want to contain any tabs, I'll put a
"set tabstop=99" into that file's directory so I don't accidentally
enter any tabs into the file.  Both of these work great, both when
I work with the files or when someone else does.  However, if those
files are edited from a different directory (e.g. "vi dir/file")
it's .exrc is not used and things go wrong.

This would be a lot more useful than the present behaviour of looking
at the current directory unless that directory is home.

pim@bsovax.UUCP (Pim Willemsen) (02/15/88)

In article <2853@whutt.UUCP> cher@whutt.UUCP (Mike Cherepov) writes:
>In article <329@ttrde.UUCP>, mellman@ttrde.UUCP (Thomas Mellman) writes:
>> It appears that vi's behaviour has changed with regards to its .exrc files.
>> even when the EXINIT variable is not set, only the .exrc file in my home
>> directory is read.
>
>Just modify your $HOME/.exrc file to include the line:
>set exrc

We are running 4.1 BSD and I use EXINIT to define some key-sequences 
that contain a ^D; as this doesn't seem to work in a .exrc file.
So the environment variable EXINIT looks like:

    map ^D B|etc...|source $HOME/.exrc

The vertical bar '|' is a separator and the source command directs 
vi to read further key mappings from the file .exrc in my home directory. 
This works just fine.  I don't know whether the source command
is available in system V.

-- 
------------------------------------------------------------------------------
   Pim Willemsen           |    =========   BSO/Automation Technology
   mcvax!bsovax!pim        |    == BSO ==   POB 8052
                           |    =========   3503 RB  Utrecht, The Netherlands

jum@cosmo.UUCP (Uwe Mager) (02/16/88)

In article <16883@watmath.waterloo.edu> rbutterworth@watmath.waterloo.edu (Ray Butterworth) writes:
>Actually, I'd like to see the current behaviour of .exrc changed
>to yet a third possibility.
>
>VI should not look in the current directory.
>It should look in the directory containing the file being edited.
>
>If I have a file with non-standard tabstops, I'll put the "set tabstop="
>command into a .exrc file in that file's directory.

I recommend putting a line like this into your file:

	vi:set tabstop=4|set sw=4:

Vi will look for such lines in the first or last five lines of the file
being edited.

PS:
This is also a nice feature for attacks if you have an !  command
in the last five lines.
-- 
Jens-Uwe Mager
jum@focus.UUCP || jum@cosmo.UUCP