I’m a UNIX guy.
After years spent on using a myriad of flavors (*BSD, Linux, Solaris, Mac OS X), I can hardly go back to Windows. For me, the experience of going back to Windows is very similar to the experience of using UNIX to most people. It’s all about familiarity.
One reason why I find UNIX so productive relates to the customizations I’ve created for myself over time. I have customized bash (tcsh before) and vim to use everybody’s best tricks.
Unfortunately, I now live, day-to-day, on 4 different machines:
- my iBook (Mac OS X)
- my PVR (Gentoo)
- my work laptop (Windows with many CentOS in VMWare)
- several lab machines (CentOS–one account thanks to NIS and NFS)
I had not gone through the effort of synchronizing my environments, therefore my tricks were all over the place. My customization weren’t guaranteed to be present which resulted in me shying away from using them.
Today I hit my fill and decided to spend the time necessary to set my environments properly.
My life changed for the better after I read about Using Subversion to Maintain your Configuration Files. While I did keep my dotfiles in svn before I read the article, I was rather annoyed by the less-than-optimal setup. Now I can keep my dotfiles in ~/etc and symlink to them.
Here’s the content of my ~/etc directory:
# find . -type f -not -ipath '*.svn*'
./bash/aliases.sh
./bash/bindings.sh
./bash/local/aliases.sh
./bash/local/variables.sh
./bash_profile
./bashrc
./irbrc
./symlink_it.sh
./vim/after/ftplugin/ruby.vim
./vim/after/syntax/diff.vim
./vim/filetype.vim
./vim/ftplugin/html.vim
./vim/ftplugin/python.vim
./vim/ftplugin/ruby.vim
./vim/ftplugin/sql.vim
./vim/ftplugin/txt.vim
./vim/ftplugin/xml.vim
./vim/plugin/spacehi.vim
./vim/syntax/txt.vim
./vimrc
A few notes:
- symlink_it.sh creates the symlinks to the versioned versions:
#!/bin/sh cd .. ln -sn etc/bash .bash ln -sn etc/bashrc .bashrc ln -sn etc/bash_profile .bash_profile ln -sn etc/vim .vim ln -sn etc/vimrc .vimrc ln -sn etc/irbrc .irbrc
- bash/local contains the shell scripts that are conditionally loaded to override the defaults (svn propset svn:ignore local bash). Here’s a preview of the relevant parts from my .bashrc:
cond_source () { if [ -f $1 ]; then source $1 fi } cond_source "$HOME/.bash/local/variables.sh" cond_source "$HOME/.bash/aliases.sh" cond_source "$HOME/.bash/local/aliases.sh" cond_source "$HOME/.bash/completes.sh" cond_source "$HOME/.bash/local/completes.sh" cond_source "$HOME/.bash/bindings.sh" cond_source "$HOME/.bash/local/bindings.sh"
Now I just wish I had taken the time before…