ggkmath
ggkmath

Reputation: 4246

CentOS and vim sourcing vimrc file

I'm using CentOS, which appears to have vim installed by default. I located the vimrc file in the /etc directory. However, I added syntax on and set number in the vimrc file and then started vim and created a hello world C program. Neither line had any effect. But when I type :syntax on or :set number from the command prompt, they work. Thus, it seems the default install somehow can't find the vimrc file (?), since it doesn't appear to use it. When I type at linux prompt: ~/.vimrc it says "No such file or directory."

Any idea how I specify the location for vim to find vimrc file?

Edit: when I type :version I see,

system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"

But, from linux prompt, when I type echo $VIM nothing is returned. If I export VIM = /etc, still no effect when starting vim. When I echo $HOME I see /Users/<username>.

Upvotes: 2

Views: 16500

Answers (2)

Brian Agnew
Brian Agnew

Reputation: 272297

I would normally expect this to reside in your home directory. Note that typing:

:version

Will tell you where Vim expects to find stuff.

e.g.

  system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"

Upvotes: 6

slackmart
slackmart

Reputation: 4934

Just copy the vimrc file to your home directory.
The vimrc should be as hide... You know .vimrc

Upvotes: 4

Related Questions