Ramblings of General Geekery

Showing off your dotfiles

With the introduction of my first Apple laptop a few years ago, my home
computers went from being half Unix-like (I had a healthy mix of Linux and
Windows machines) to mainly (two thirds) Unix-like. With it came a change in the
kind of software I use on a daily basis and an increased need to synchronize the
configuration of those programs between my machines.

Enter the “dotfiles community”: an informal group of people who, as Zach
Holman puts it, think that “dotfiles are meant to be forked”.

“Dotfiles” are rooted in Unix culture – the name refers to the configuration
files starting with a dot that clutter your home directory like crazy. This
means you will mostly find Mac and Linux users in there (that’s ok, they’re
pretty nice… usually), but to me it’s mostly about putting all your
configuration files in source control in a way that makes it easy to setup new
machines and share with others.

Show-off :-)

So like everybody else, I put my dotfiles out there for anyone to
poke around. They’re mostly boring, but you may find a few useful things, like
those I outline below (after the break). Nothing earth-shattering, but if it
saves you the 15 minutes needed to write it, that’s 15 minutes you can spend on
doing actual stuff.


Most people store their dotfiles in a Git or Mercurial repository, and then
create symlinks from their home directory into the repo (like, for instance,
linking $HOME/.vimrc into $HOME/DotFiles/vim/.vimrc). Because I also need
some of those configuration files on Windows, I can’t really hard-code paths
like this.

As a result, I opted for generating some of my dotfiles when I run my install
. Those dotfiles mostly only include the real ones from the
repo. This lets me clone my dotfiles repo anywhere I want – no need to
hard-code anything.

Mercurial config includes

An often overlooked feature of Mercurial’s config files is the %include
statement which lets you include other config files. This lets me specify
OS-specific config files to my hgrc, and even optionally have a local
config file (since the %include statement will quietly fail if the included
file doesn’t exist).

Cross-platform, multi-language Vim

If you’re running Vim on both MacOS and Windows, you may be interested in a few
lines from my .vimrc, like when it figures out the directory for all
the Vim runtime files (.vim on MacOS, vimfiles on Windows).

You may also be interested in a couple of international features I have:

  • A mapping to switch keyboard layouts in input mode (I switch between English
    and French)
  • A mapping to switch spell-checking on and off, and the language it will be
    checking against is in sync with the input mode keyboard layout.

That’s it! I hope somebody finds it helpful in some way.