I have several configuration files I keep on my home folder for several applications, most of which is what in Unix-speak is usually known as "dotfiles". This includes things like my VIM configuration and runtime files, my Unix and PowerShell profile scripts and so on.

Naturally, I want these to be available on all of my machines, and synchronizing them manually has always been a drag, but so far, I had not really looked too hard at how to avoid it.

The most natural way to do this was, of course, source control, which I wanted to have anyway. It was easy enough to use SVN or GIT for this, but one thing had prevented me from going this way: File name conventions.

A few weeks ago I ranted about how some cross-platform applications would use a different set of file/folder names when running on windows instead of Unix, and how this was a nasty legacy coming from the old FAT/FAT32 days, but was not so much of a problem with NTFS.

There was a point to that rant, very related to today's post: What prevented me from using simple source control to share my dotfiles between my Windows machines and my Ubuntu machines was exactly this issue with the renamed dotfiles.

In particular, one of the things that constantly nagged me was having to rename my _vimrc and vimfiles/ directories from Windows to .vimrc and .vim/ when synchronizing them to the Ubuntu machines. It was a royal pain, and one that source control wouldn't solve at all.

Fortunately, turns out there's an easy way to avoid this with GVim on Windows, so that I could use .vimrc and .vim/ there as well:

  1. It appears that .vimrc is natively supported in modern VIM versions. I don't know when this came to happen, but I just renamed my _vimrc to .vimrc and it just worked. Pure goodness.
  2. Renaming vimfiles/ to .vim didn't work right out. But, fortunately, you can change the set of folders that VIM will look into when loading runtime files by modifying the runtimepath option. So I just added this right at the top of my .vimrc file:
set runtimepath=~/.vim,$VIMRUNTIME,~/.vim/after

Restarted VIM, and it just worked. Fantastic! I'm now simply using git to keep my dotfiles in source control and synchronizing them between machines is simply a matter of doing git pull/push every once in a while. Very nice.

Technorati tags: , ,


Tomas Restrepo

Software developer located in Colombia.