A Weekend with Z Shell

Almost a year ago, I was introduced to the Z Shell (or zsh), an alternative shell to bash, through Kenneth Reitz. Unfortunately, at the time it felt way too foreign. The uphill battle to configure the damn thing outweighed the pros that zsh was meant to provide. Also, I was too entrenched with the default command line shell that had been spoon-fed to me ever since I installed Ubuntu for the first time.

So I left it at that.

Fast forward to the beginning of this year and I ran into this article, “My Command Line Prompt,” by Geoffrey Grosenbach of topfunky and PeepCode fame. I gained interest almost instantly. Why? The visuals of course. It was a great mini-tutorial on what zsh could do. So over the weekend, I grabbed oh-my-zsh, a wonderful starter kit from Robby Russell and went to work on the train to and from my parent’s place.

Here’s what I came up with in pretty picture form:

(The font I use is Inconsolata.)

This is an amalgamation of ideas from Kenneth’s oh-my-zsh theme and the aforementioned blog post by Geoffrey. It moves everything but the current directory to the right side of the prompt, also including the current virtualenv or rbenv when applicable. It has an easter egg as well, mainly for my own giggling satisfaction when a command boards a ship to fail.

If you’re interested in seeing the code behind this, you can take a look at my new dotfiles repository. (There are a few goodies in there which are beyond the scope of this post.)