tags:

views:

1026

answers:

5

I am not a very orderly person at times and I often find myself in the situation of loosing my old fully tweaked vimrc file and having to start over all again. Or having different versions of vimrc files on different clients. Since this mess is getting out of hand for me, I would like to know if there is a good way of managing your vimrc file.

I now uploaded a vimrc file to a subversion server (Google Code) with the intention of maintaining that one. Yet, any other/better ideas are welcome.

EDIT: I found a nice solution: add the vimrc file to your SVN repository in a folder named Vim (same name as your local Vim program folder) and check this directory out on top of your Vim folder. SVN might complain a little about already existing files being present, but you can add those to the SVN ignore list. If you do that, then your active vimrc file is on source control. How cool is that?

+3  A: 

Use git. I have my .vim and .vimrc files in a git repo, and I branch them for different systems. So i have on branch for lappy, one branch for debian-based , one for RH based etc.

I fire the repos up onto all my servers, and merge changes around as I see fit. Then, when i lose one, any of the others will serve. .vim/.vimrc are an excellent examples of files that should be in a DVCS.

chiggsy
Why are you saying "use git" and not simply "use your favorite revision control system"? Is there some advantage to git over, say cvs, svn, Perforce...?
StackedCrooked
Why branch them for different systems? That just seems like a pain when you want to make common changes that might not merge especially well down the road after you've made hugely divergent changes. You can test the system in your .vimrc and put all your settings in one, which is far handier when going to a new system, since you only have to bring along one .vimrc that will probably work. (And even better than testing system is testing capabilities)
Nick Bastin
+9  A: 

I put these files in a source control system, subversion specifically, but it doesn't matter which. That gives me a history of all such configuration files, and it's just a matter of checking out the config file when I want the same one on a new/other machine or useraccount.

nos
This is exactly what I do. Upvoted. (I also keep my Vim plugins in the same repo as my .vimrc)
skinp
A: 

I keep a copy of my dot-files on google docs.

Nifle
+11  A: 

I use Dropbox. I've created a folder vim in my dropbox, which contains my .vimrc (actually: vimrc.vim) and colors, plugin, etc. directories.

Dropbox pushes all these files to all my computers (home, work, laptop, Bootcamp), so every time I want to change my vimrc, I can do so and I don't have to worry about copying it to the correct directory or checking out the file from SVN or anything. Everything happens automagically!

My actual .vimrc contains only what's necessary to load the stuff I have in my Dropbox. On OSX, it looks like this:

set runtimepath+=~/Dropbox/vim
source ~/Dropbox/vim/vimrc.vim

On Windows, like this:

set runtimepath+=$HOME/My\ Documents/My\ Dropbox/vim
source $HOME\My Documents\My Dropbox\vim\vimrc.vim

And that's it!

(Actually, I put the vimrc's above in my Dropbox as well, so I don't have to remember them whenever I set up a new computer or re-install an old one.)

I haven't actually tested this on Linux yet, but I see no reason why it wouldn't work. Especially if you use GNOME, for which Dropbox has a nice client.

The free version of Dropbox will give you a 30 day revision history, the paid one will give you full revision history.

jqno
I voted this up not because it recommends using dropbox, which I am not such a fan of. I voted it up because of the handy examples of how to use set runtimepath and source to load up external vim and vimrcs.
Apreche
+1  A: 

Like others have said: use a version control system.

Here is such a project, easy to fork and extend: http://github.com/ryanb/dotfiles

It does not only handle vim.rc, but all kind of configuration and comes with a setup script.

blueyed