Saturday, March 10, 2012

My terminal/shell


Just a quick post about what my terminal looks like these days.

Some things I value in my terminal:

  • Good looking/easy on the eyes (using color-theme solarized
  • Being able to bootstrap my setup fairly quickly on new machines
  • Portable setup between OSX/iterm2 (at work) and Ubuntu Terminal (at home)
  • Good git support

I strap the boot by cloning my prefs (collection of my environment/config files) into my home-dir (I still have to manually install zsh at some point):

git clone git://gitorious.org/testing-git/prefs.git

And then "deploy" the config files into my environment:

cd prefs
./deploy.sh

Now I could've probably used puppet for boostrapping this on new machines, but so far I've managed with just a little deploy.sh that copies the files into the right places, and a reverse-deploy.sh that copies them back into my prefs dir after I have played around with making changes locally.



I use zsh, assisted heavily by the oh-my-zsh configuration, instead of regular bash. Reasons are:
  • Very smart globbing (smart tab-completion when looking for files)
  • Nicer history completion (up and down arrows, also globs)
  • Neat git features (marks prompt when git status is dirty, etc)
The out-of-the-box git interaction in oh-my-zsh is lacking in some areas though. It shows branch in the prompt, but not fancy stuff like rebasing status, bisecting, and so on. For this I use Shawn Pearce's git-completion.sh. To make the two work come together, I modified oh-mz-zsh a bit, and built my zsh prompt like this

As a result, I get stuff like this (click for larger version):


Note how the prompt notes the repo as being dirty when I touch foo.

Also note the fancy interactive tab completion of zsh and git commands:


My prefs repo also brings in my .gitconfig (of course), my .vimrc (also color-themed with solarized), my .zshrc, a bunch of handy bin files I like to bring along, some RVM configuration, some PATH building for various Java development, and it all works pretty much on both Mac and Linux.


It's a bit of a chaotic patchwork, but it works, and gives me a pretty cool and nice-looking terminal to work with, I think.

A last thing about zsh is that it allows me to "grow", by gradually learning new features and tricks. I'm no bash expert, but I have a feeling it is a bit limited, or archaic in this space.