Let’s say you want to update capybara and capybara-webkit. You’d normally type this:
gem update capybara capybara-webkit
But you’re busy, you don’t have time to type “capybara” twice. Let’s see what tab completion has for us:
gem update capybara{,-webkit}
The bracket expression expands to the same thing as above because the brackets expand to "capybara" + "" and "capybara" + "-webkit". If you’re in ZSH, you can press the TAB key (gem update capybara{,-webkit}<TAB>) and it will expand the expression for you inline. Bash users, this will still work for you, even without the neat TAB trick.
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
/Users/gabe/src/rspec-core
$ cd hoptoad
$ pwd
/Users/gabe/thoughtbot/hoptoad
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.