cd'ing to frequently-used directories in ZSH

Josh just dropped some sweet, sweet ZSH knowledge. I spend a lot of time in the directories under $HOME/thoughtbot/ and $HOME/src, and to get there I type (for example) cd ~/thoughtbot/hoptoad. There is a better way!

First, add this to your ~/.zshrc and source it:

setopt auto_cd
cdpath=($HOME/thoughtbot $HOME/src)

Obviously, use different paths in cdpath depending on which directories you cd into a lot.

Now let’s try it out:

$ cd rspec-core # Autocompleted from rspe<TAB>
$ pwd
$ cd hoptoad
$ pwd

Seriously, check out your coworkers' dotfiles. It can improve your workflow efficiency by an order of magnitude. Like most of the Thoughtbot crew, Josh keeps his dotfiles on Github.

Hound automatically reviews Ruby, JavaScript, and CoffeeScript code in your GitHub pull requests and comments on style violations. It is free for open source repos and $12/month per private repo.