Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I made a simple .exrc vim config file in my home directory on RHEL 5.8. Here are the contents:

set nu

However, when I go into vim, the line number are not shown. It may be worth noting that I am logged in as a shared application user ID. I have access to other RHEL 5.8 hosts here at work as well under my own user and .exrc file does in fact work.

Any idea what the problem might be?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

That file is for vi (or nvi). You want .vimrc.

share|improve this answer
    
Thanks, that worked. But how come .exrc works with my other RHEL user as well as on my home laptop, which is Fedora 16? –  amphibient Feb 15 '13 at 18:53
    
Perhaps some setting or some alias, I can't know. –  schaiba Feb 15 '13 at 19:04

Vim only reads ~/.exrc if it hasn't found a ~/.vimrc. Chances are that you already have a .vimrc file on that machine, but not on the other machines where adding the setting in .exrc works.

You can put source ~/.exrc in your ~/.vimrc to read your generic vi settings from ~/.exrc and have other vim-specific settings. If you want to read ~/.exrc only if it's present, use

if filereadable('~/.vimrc')
    source ~/.vimrc
endif
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.