Bracket Expansion

Gabe Berke-Williams

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 abovebecause 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.