My dotfiles

grantm on 2006-06-22T22:20:43

Since Ovid seems to be getting buried under "Duh! - Use a revision control system" comments, I thought I'd describe my solution here.

I have a CVS repository (I'd use SVN if I was starting from scratch) that contains my 'dot' files and other stuff. I check it out into a directory called '.common-configs' with a command like this:

cvs -d ":ext:grant@cvs.server/cvs" co -d .common-configs grant/configs

Then I cd into .common-configs and run './install' which interactively walks me through installing each of the files. Some of them are a straightforward replacement of the default ~/.file with a symlink to ~/.common-configs/file. And some of them leave machine-specific things in ~/.file and append the necessary entry to include the contents of ~/.common-configs/file.

So what's in my CVS repository?

bashrc
A collection of aliases, shell functions, PATH manipulations and general environment hacks that I've assembled over the years. Includes the 'hint' alias (see below).
cvsrc
Standard things like setting -q on all commands, -u for all diffs and -dP for all updates.
cvstssh
A script for tunneling CVS (backwards) through SSH. Used for situations where the target machine can't SSH to the CVS server but it is possible to SSH from the CVS server to the target machine.
hints
A bunch of hints used by the 'hint' alias (see below).
inputrc
GNU readline tweaks like setting Ctrl-F for going forwards through command history (after you went too far with Ctrl-R).
irbrc
My shiny new 'irb' preferences file (Ruby Rocks!)
perlcheck
My .vimrc maps F4 (typically 'make') to pass perl scripts/modules to this script. It's essentially just 'perl -cw' but preceded by all sorts of adjustments to PERL5LIB depending on the full pathname of the file being checked.
vimrc
A modest collection of config hacks for the 'one true editor' :-) My bashrc commonly aliases 'vi' to 'gvim' where available and supported by X forwarding etc.
templates
A directory containing a collection of template files accessed by the ',t' macro from vim. Templates include: html (a skeleton HTML file with DOCTYPE, content-type/encoding and stylesheet tags); perlscript (skeleton script with Pod::Usage and Getopt::Long code and POD); pod (POD outline for a .pm file); test.t (standard Test::More invocation with and without a plan); and sundry other things.

The hints file is becoming increasingly necessary as my memory fails and the scope of technologies I deal with increases. The hints file itself is merely a plain text file of one-line entries of the form:

keywords:command

My bashrc file defines one shell function and one alias:

function hint() {
    test -n "$*" && sed -n "/$*/Is/^\([^:]*:\) *\(.*\)$/\1\n\2\n/p" ~/.common-configs/hints
}
alias vihints='vi ~/.common-configs/hints'

Then when I want to be reminded of (for example) the command syntax for fixing a typo in a CVS commit message, I just type:

hint cvs fix

and get a response like this:

cvs fix comment:
cvs admin -m 1.12:"replacement commit message here"

The point is that the output from 'hint' is something that I can cut and paste and adapt to my current requirement. The other important thing is that the things in the hints file are things I have had to search for and things I find useful. It's not clogged with things that other people think I need to know. Therefore I won't tell you what is in the file but just tease you with a random sample of topics covered:

  • CVS
  • Subversion
  • Debian package manipulations
  • GnuPG
  • Perl one-liners
  • ImageMagick hacks
  • LDAP queries


dotfiles everywhere

dws on 2006-06-23T21:18:32

You've shamed me into a cleanup. I don't think any one of the systems that I have or use has consistent customizations.

Re:dotfiles everywhere

skangas on 2006-06-24T23:05:20

I have a CVS repository (I'd use SVN if I was starting from scratch)


How do I convert an existing CVS repository into a Subversion repository?


I have to confess, I haven't come around to convert my repository either. /Stefan Kangas