Zsh Evangelism

After a decade of stubbornly sticking with bash, I've changed shells to zsh and couldn't be happier with the decision. The only regret is in not having switched long before now. This was a svn => git1 sort of transition for me: of course, I should've been using it all along!

By way of evangelism, a few notes on my configuration:

Prompt

It is much easier and cleaner to customize a zsh prompt than in bash. It also has a notion of an RPROMPT – the right-aligned prompt – which is excellent for supplementary directory information2. Zsh Prompt

My prompt configuration can be found here.

Oh My Zsh!

Another advantage of switching to zsh is the opportunity to use oh-my-zsh, a set of plugins, helper functions, and themes for zsh. I'm not using any of the themes directly3, but the plugins are really nice, and provide, for example, tab completion for executables like ruby, git, etc.

Dotfiles

I've structured my dotfile repository in a modular way: separating into various concern areas such as aliases.zsh, functions.zsh, and so on. The top level ~/.zshrc symlink-target consequently reduces down to a simple script; its only job is to set a few zsh options and then source the individual modules:

#!/bin/zsh

setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE

export DOTFILES=$HOME/git/me/dotfiles
for zsh_config in `ls $DOTFILES/zsh/*.zsh | sort`  # Sort => source in order.
do
  source $zsh_config
done

If, like me until recently, inertia still keeps you on bash – definitely give zsh a try. You won't regret it.


  1. Well, any source control system => git, really. 

  2. In my case: git repository status and ruby version information as set by rbenv

  3. My prompt is a custom version of the gallois theme.