Tuesday, May 13, 2008 
« Review: What the Dead Know | Main | Review: Garnethill »
Sharing Dotfiles between Windows and *nix

Tomas Restrepo wrote a post about sharing dotfiles between Windows and Ubuntu, specifically about sharing .vimrc (Linux) and _vimrc (Windows) and the .vim (Linux) and vimfiles (Windows) directories.

I have a different solution. On Windows, my C:\AutoExec.bat includes:

set HOME=C:\gvr
set VIM=C:\Vim
set VIMDIR=%VIM%\vim71
set EDITOR=%VIMDIR%\gvim.exe
set PATH=%PATH%;C:\Win32app;C:\GnuWin32\bin;C:\UnxUtils;C:\SysInternals;C:\Python25\Scripts

%HOME% (C:\gvr) contains _vimrc, vimfiles, and other stuff accumulated over many years. This directory is stored in a personal Subversion repository at DevjaVu. All my Vim files are stored with Unix LF endings, not Windows CR-LFs, so that they'll work on my Mac OS X and Linux boxen. I play some games with if has("win32") and if has('gui_macvim') to ensure that my _vimrc works cross-platform.

On my *nix boxes, the gvr folder lives under my home directory at ~/gvr, and ~/.vimrc and ~/.vim are symlinks:

$ ln -s ~/gvr/_vimrc ~/.vimrc
$ ln -s ~/gvr/vimfiles/ ~/.vim

In addition, the dotfiles that I keep in SVN are stored locally in ~/gvr/dotfiles without a leading period in their names, which makes them easy to see:

$ ln -s ~/gvr/dotfiles/bashrc ~/.bashrc

This arrangement works well for me.

posted on Wednesday, May 14, 2008 6:28:36 AM (Pacific Daylight Time, UTC-07:00) 
#    Comments [1]
Related posts:
Vim 7.2 is released
MacBook Makeover
Odds and Ends #8
Odds and Ends #7
Virtualization
Macalicious
Wednesday, May 14, 2008 12:55:07 PM (Pacific Daylight Time, UTC-07:00)
Thanks for the tip George; yes, that's another good way to work around the issue! I always forget about symlinks! Regarding the CRLF thing, it can be a pain at times. Right now, I'm just making sure that on Windows I always save everything with CRLF and then let git deal with the platform differences. Seems to work fine for the most part.
Comments are closed.