Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to put the .vimrc into the .vim folder so that I only have to sync the whole folder and not folder and file to other computers?

share|improve this question

3 Answers

up vote 8 down vote accepted

I keep my .vimrc in .vim and symlink it.

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

On Windows I believe you can do the same with mklink.

share|improve this answer
I do this, and also have the .vimrc directory on github which makes it very easy when setting up a new account. This is described in the first steps of this vimcast – pmac72 Jun 26 '12 at 21:16

If you were to create an alias for vim to specify the location of the .vimrc like thus:

alias vim='vim -u ~/.vim/vimrc'

then you could do away with having .vimrc separate.

BUT

This will cause issues with other programs interacting with vim. Pressing 'v' in 'less' will not work, since it calls vim via the contents of the EDITOR env-variable. I suppose you could add the '-u ...' bit into the EDITOR variable. might work.

For gvim, you'd use an uppercase 'U' there, to specify the location of the .gvimrc file. Again, issues ensue unless you change EVERY possible starting location of gvim in your window manager's starting links.

All in all, I'd suggest using @remyo's suggestion if you MUST have it all in one subdir.

It's relatively easy to create a post-pull script that would reestablish the link between 'repo/.vimrc' and '~/.vimrc'.

Good luck.

(you could recompile vim yourself, specifying a new default location for the .vimrc file.)

share|improve this answer
+1 for adding recompile as an option ;-) – epsilonhalbe Jun 18 '12 at 22:19
Okay, that sounds like creating more problems than solving. – queueoverflow Jun 19 '12 at 7:33

That's exactly what I do, with this single line in my ~/.vimrc:

runtime vimrc
share|improve this answer
1  
Okay, but I still got to have a .vimrc then. Then I just use the one you gave me in the other question. – queueoverflow Jun 18 '12 at 15:59

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.