.exrc is not working

Hi

I want to customise my vi environment.So i have created a a .exrc file in my working directory and written all set commands.But when i am invoking vi ,it is not taking any effect of the vi.

Can anybody have any idea what is happening

Thanks in advance

Regds
Sas

Sas,
Could you display a sample of your '.exrc' file?

Following commands are written in .exrc file

set nu
set ai
set showmode

thanks

Sas

Doesn't your .exrc file have to placed in your home directory, rather than your working directory?

I have put the .exrc file in the directory specified by $HOME

Thanks

Sas

... I don't know what "ai" does, but if you want to see line numbers, try set nu showmode in one line. , i.e.

#  cat .exrc

set nu showmode

#

set ai means set auto indent.But any idea why it is not working

Is your version of 'vi' actually a link to 'vim'? If so, you might want to use .vimrc instead. I don't think vim looks at .exrc files. (At least not on my Linux box.)

But my unix is HP-UNIX version 11i

Regds

Sas

I am facing same prob ! pls help

In all modern versions of vi, you have to first set the exrc option in your home directory's .exrc file before vi will read the .exrc file in the current directory:

set exrc

This mechanism prevents other people from placing, in your working directory, an .exrc file whose commands might jeopardize the security of your system.

An alternative is to set the EXINIT shell variable.
But I use a $HOME/.exrc all the time ('cos I like the "set ai" functionality).

I'm sure you've already found and fixed your problem by now, but... for others who may run into the problem (like I recently did), you may want to check to make sure you DON'T have EXINIT defined in your environment. If it is, this will override anything you have in your .exrc file.