hhvlaw
Last Updated: February 25, 2016
·
641
· artemeff

Fastest way to change current directory

I'm tired to each time write following commands:

$ cd ~/work/rails/project_name
# or
$ cd ~/work/git/repo_name

And I write tiny and useful function for zsh:

~ $ work rails project_name
~/work/rails/artemeff $
# or
~ $ work git repo
~/work/git/repo $

Function code:

function work() {
  cd ~/work

  for key in $*; do
    cd $key
  done
}