2

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?

2

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

  • 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
4

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('~/.exrc')
    source ~/.exrc
endif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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