This may not be the best place to ask this question but I'm having trouble getting vim to read my vimrc file. If I have it in the home directory as ~/.vimrc then it ready just fine but if I move it ~/.vim/vimrc so that I can take advantage of plugins and a few other things, it no longer reads the vimrc. I can't remember what I was supposed to do to make it read the correct vimrc.

  • You should explain more about 'take advantage of plugins', because nothing I know of would prefer you from using ~/.vimrc for everything. – Jason Salaz Dec 29 '11 at 22:36
  • When I was in Ubuntu and I started using vim plugins it had me make a .vim directory and inside that a plugins directory and move my .vimrc to the .vim directory – CaldwellYSR Dec 29 '11 at 22:38
  • I used to use vimbuddy (before I had plugins that actually did something functional), installed in ~/.vim/plugins, and I just used source ~/.vim/plugins/vimbuddy.vim from within my ~/.vimrc file. – Jason Salaz Dec 29 '11 at 22:41

A method of blindly loading all your plugins, assuming they are all in ~/.vim/plugins, would be putting the following in your ~/.vimrc:

source glob(~/.vim/plugins/*.vim)

I created a symlink.

ln -s ~/.vim/vimrc ~/.vimrc

Works like a charm.


The easiest way would be to remain using a ~/.vimrc file, if for no other reason than using it to read in your sub-folder based .vimrc

Putting something like the below in your ~/.vimrc should work:

if filereadable("~/.vim/vimrc")
        source ~/.vim/vimrc

I don't recall if vim expands home directories or not. I imagine it does, but if it does not, just use:

if filereadable("/Users/yourusername/.vim/vimrc")
        source /Users/yourusername/.vim/vimrc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .