Posts Tagged ‘irb’

zsh: Scratching a geeky itch

Saturday, April 4th, 2009

I’ll apol­o­gize right out of the gate for the resem­blance this post bears to one Rafe Col­burn made today. We sit across from each other at work, and we’re both div­ing into zsh at the moment, so cross-pollination was prob­a­bly inevitable.

The other day, I switched my shell from bash to zsh. Just like Rafe, I read the Fried CPU post about zsh, and was con­vinced to give it a whirl. It’s been in the back of my mind for a while now, since I’ve notice that a lot of peo­ple whom I respect (Ryan Bates, for one) are using it, but the con­cise list of really pow­er­ful fea­tures in the Fried CPU arti­cle was the tip­ping point. I’ll admit that, never hav­ing switched shells before, I thought it was going to be a heck of a lot more com­pli­cated than just typ­ing chsh and replac­ing “/bin/bash” with “/bin/zsh” in the con­fig file that pops up. Had I known it would be that easy, I would’ve tried it a lot sooner.

At first, I tried copy­ing huge chunks out of the zshrc & other zsh con­fig files that Joe Fer­ris main­tains in a repo at Github, but even­tu­ally decided I’d get more out of this exper­i­ment if I took more bite-sized chunks out of other peo­ples con­fig­u­ra­tions, and only added them to my own when I under­stood what they were doing.

That’s when things got out of hand.

When I was copy­ing bits of my old bash con­figs over to my zshrc, I noticed how dis­or­ga­nized all of my dot­files were–not just the shell ones, but my irbrc, and vim & emacs con­figs, etc., etc., etc. So I basi­cally decided to scrap all of them and take the same approach to them as I was tak­ing with my shell con­figs. So basi­cally, I’m start­ing over with Unix, and slowly rebuild­ing what I’m hop­ing will be a super-organized and super-optimized envi­ron­ment for future work and play.

If you’re inter­ested in see­ing how things develop, you can fol­low along with my dot­files repo on Github. But what I’m sure will be infi­nitely more inter­est­ing will be to start on your own adven­ture in Unix con­fig­u­ra­tion. If you go down that road, here are some of the resources I’ve used in rebuild­ing my environment:

  • Joe Ferris’s config_files repo: I men­tioned this before, but it’s worth men­tion­ing again, due to its being awesome.
  • dotfiles.org: User-conributed dot­files for just about every *nix-based util­ity that uses a text-based con­fig­u­ra­tion file.
  • irb & script/console tips: Obvi­ously these are only use­ful to Ruby­ists, but if you swing that way, the­ses are well worth check­ing out. Ever since I first saw the SQL gen­er­ated by an ActiveRe­cord query show up in someone’s script/console, I’ve cov­eted that func­tion­al­ity. Dan Croak shows how it’s done.
  • Dr. Nic also has some great irb tips
  • Finally, I cribbed a git-aware prompt from this screen­cast. A very neat trick.

So yeah, it’s been really fun get­ting back to basics with my Unix con­figs. That said, I have had one small hic­cup in this process. After going through all of this with my OSX ter­mi­nal, I went to switch my shiny new Ubuntu JeOS VM’s shell over to zsh, but found that after doing so, my delete key wasn’t behav­ing like a back­space as it had been doing when I was using bash. Appar­ently this is a known issue when using zsh or screen over ssh. I still haven’t found a good workaround for this, and so am still using bash in Ubuntu.

All in all, switch­ing from bash to zsh has been an extremely reward­ing expe­ri­ence, and def­i­nitely one I’d rec­om­mend to any­one look­ing to change up their rou­tine and learn some­thing new and useful.