Operating System - HP-UX
1823938 Members
3386 Online
109667 Solutions
New Discussion юеВ

vi not reading the default configuration file (.exrc)

 
Amit Kureel
Advisor

vi not reading the default configuration file (.exrc)

I am using Ksh as my login shell and I have created a .exrc file in my home directory but even then vi is not taking the conffigured parameters from my .exrc file

Can anybody tell me how to set the EXINIT in ksh through my .profile ?

- Amit Kureel
20 REPLIES 20
Antoanetta Naghiu
Esteemed Contributor

Re: vi not reading the default configuration file (.exrc)

Did you create the .exrc file being login with your login or as root? Check the permision and ownership on the .exrc file
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

The permissions and the ownership is perfectly fine. But one error that I could trap is that whenver I open a file, vi flashes the error message :
No lines in the buffer

What could be the reason...?

- Amit Kureel
rajsri
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

Hi
pls have a look in the man page of ex command.
rajsri
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

Amit
check env output for EXINIT , if it exists unset EXINIT then , edit .exrc and put the values you want and try.
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Hello Rajsri,

EXINIT is not set in the env, in fact when I try to set it through my .profile as :

set EXINIT 'source $HOME/.exrc'

and after that if I try to open a file, vi flashes the following error message :
"=/$HOME/.exrc" doesn't exist"

I wonder why it is putting this "=" before the path....?

- Amit
RikTytgat
Honored Contributor

Re: vi not reading the default configuration file (.exrc)

Hi,

There might be an error with the definition of your home directory inn /etc/passwd.

Could you please check whether there is no '=' in there.

If this is wrong, it can't find the .exrc file you put in what you think is your home directory.

Bye,
Rik.
RikTytgat
Honored Contributor

Re: vi not reading the default configuration file (.exrc)

Hi,

If the homedir definition in /etc/passwd is correct, check the contents of your $HOME environment variable.

If this contains the '=' sign, and your homedir in /etc/passwd does not, check your shell startup files for the string HOME. A typo somewhere may have caused your homedir to contain the '=' sign.

Bye,
Rik.
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Hello Rik,

Thanks for your effort but, both the $HOME and the entry in /etc/passwd are perfeclty okay...

Can anybody tell me what is the correct syntax to set EXINIT in my .profile or the one I mentioned in my previous reply is fine...?

-- Amit Kureel
Andreas Voss
Honored Contributor

Re: vi not reading the default configuration file (.exrc)

Hi,

try this one:
In your .profile add the line:
EXINIT=$(cat $HOME/.exrc)
If you are using CDE either add this line into .dtprofile or set DTSOURCEPROFILE=true

Cheers

Andrew
curt larson
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

the ex editor commands in the EXINIT variable need to be seperated by a "|" character, so a cat .exrc isn't exactly going to work. So a cat .exrc | tr "[012]" "|" would work better assuming you have only one command per line and your commands don't have a newline character in them.

Instead of trying to figure out how many ways a newline character shows up in your .exrc file, it might be better to copy your .exrc file to another file, maybe .exinit. Then put your commands all on one line, seperated with |'s. And then just cat the file as previously suggested.
nobody else has this problem
rajsri
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

Amit,
Small question dont mind ,
with out setting EXINIT , if you try vi any file and say ESC : set number , is it giving line numbers , if so you can try concentrate on setting EXINIT on .profile , if its not working then u can look in to vi .
curt larson
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

Back to your original problem, your mention of an error message " No lines in buffer". This seems like an error message from an editor command, i.e. your .exrc file was being read and one of your commands is giving you an error.

I don't know how the ex editor handles initalization errors, but it probably stops processing commands once it encounters an error. If the error happens at the start of the file, it will seem as if it the file isn't being processed.

Try starting with a simple .exrc file. such as just a set numbers and see if your files have line numbers and go from there, adding commands until you find the one that is given you a problem.
nobody else has this problem
curt larson
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

And, if it is a bad editor command in your .exrc file that is giving you the problem, putting it into an EXINIT variable isn't going to "fix" it.
nobody else has this problem
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Hello to everybody here,

Rajsri, after having opened a file in vi, any normal ex-command is working through for example, ESC : set nu

Hello Curt, regarding the message " No lines in buffer " when I put a very simple comand like "set nows" (of course without qoutes....!) in my .exrc file, I am still getting the error, even without an .exrc file and without any EXINIT var being set, vi flashes this error message...!

-- Amit Kureel
curt larson
Frequent Advisor

Re: vi not reading the default configuration file (.exrc)

Sorry, I wasn't able to find what the problem is. But here are some suggestions for eliminating what could be the cause.

is vi the problem?
it seems like you can start vi, create files, modify files, change settings just fine. You could try editing some files from /tmp, your home directory, /var/tmp and see if your still having the same results.

is your id the problem?
are other user ids have the same issue when using vi?
have you tried using the login dot files of someone that isn't having the problem
does root have the same problem?

is the file the issue?
have other users had the same results vi'ing this file
how does vi work with other files

you've probably checked many of these things already. But maybe I've given you a suggestion for further investigation.
nobody else has this problem
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Hello Larson,

I have already checked this and strange thing is that for any other user, things appear to be working just fine, with vi quite comfortably reading the .exrc file but for this particular user of mine it's causing this problem, I even checked with a .profile of another user for whom things are working...!

Next I am planning to drop and re-create the user with a fresh .profile.....wish me best of luck, because this user is being used for the development of a huge application...

-- Amit
Fred Martin_1
Valued Contributor

Re: vi not reading the default configuration file (.exrc)

The 'no lines in the buffer error' makes me think that vi -is- reading your .exrc file, but that something in the .exrc file is at fault, not the environment.
fmartin@applicatorssales.com
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Fred,
If you check one of my earlier replies, then you will find that even in a "no EXINIT and no .exrc file" situation also I am getting this error....?

-- Amit Kureel
Vikas Khator
Honored Contributor

Re: vi not reading the default configuration file (.exrc)

Hi ,

Could you copy the .exrc file in a directory and then cd to that directory and opening the file in that directory.
Keep it simple
Amit Kureel
Advisor

Re: vi not reading the default configuration file (.exrc)

Hello,

Thanks to evrybody who participated in this discussion, I found the reason for my problem...the first line was blank in my .exrc file thats was causing this problem and by the way I found that vi doesn't read the lines after a blank line (at least the version I have....HP-UX 11.00 64-bit).

Thanks again

-- Amit Kureel