Friday, February 03, 2012

Some reasons to try out ZSH

I've been using bash forever, but I recently came across an article that introduced me to the wonders of zsh, more specifically zsh add-ons "oh-my-zsh".  Some of this is covered more thoroughly in the above article, but here's some great stuff that I've found in 20 minutes of playing around:

  1. Shared history file.  When you type history, you see a history of your commands that you have typed in any shell/terminal, throughout time.  I have completely had to re-learn things because the history command on bash let older commands drop out :).  It defaults to 10k commands, that should do for a while.
  2. Case-insensitive tab completion - just barrel right through all of those Upper Case Mac Directories, and don't stop to hit tab!
  3. Ignore dotfiles tab completion - barrel right past .svn and friends
  4. Spelling correct! When I was writing #1 above, I wanted to find what HISTSIZE is by default, and I typed "exho HISTSIZE".  zsh responded with "zsh: correct 'exho' to 'echo' [nyae]? ".  
  5. I haven't trained my fingers to do this one, but if you want to go to, say, /usr/local/Cellar/Rabbit, you can type "cd /u/l/c/r" and then tab: if it's unambiguous (it was for me), it expands.  Note I have a few possibilities for "/usr/l<tab>" - this suggests ZSH was smart enough to look ahead to try to resolve that ambiguity.
  6. Smart tab completion for command arguments: kill <tab> lists PIDs for you.  ssh <tab> lists hosts for you.  I can't wait to find other examples of this.
I'm sure bash can do all of this as well, I was just impressed at how oh-my-zsh had me up and running on this so fast.  

What am I missing?


Jeffy said...
This comment has been removed by a blog administrator.
Shalini said...
This comment has been removed by a blog administrator.