Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
    
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
    
Ah that makes a lot of sense... make that an answer and I'll accept it. –  CaldwellYSR Dec 29 '11 at 22:47
add comment

3 Answers 3

up vote 2 down vote accepted

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)
share|improve this answer
add comment

I created a symlink.

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

Works like a charm.

share|improve this answer
add comment

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
endif

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
endif
share|improve this answer
add comment

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.