Quick switching to a project's directory

During her awesome talk about containers and sandboxes at CraftConf last Friday, Jess Frazelle used a little helper function in her shell to quickly switch into a projectโ€™s directory in her shell. This little gem can be found in her dotfiles repository on github. This implementation focuses on being able to easily get into a directory within her GOPATH.

Right now Iโ€™m still switching from environment to environment quite frequently so I need something a bit different, though. Not being all that familar with scripting ZSH I need a ton of skimming through the docs but this is what I eventually came up with: cdp. It is more or less a simple function that takes a parameter, scans a handful of directories for folders with the same name as the parameter and cds into the first match.

Since Iโ€™ve always wanted to mess around with some autocompletion, thatโ€™s also support here. Hacky, but it works for now ๐Ÿ˜Š

Being not really used to writing any Bash or ZSH code my code will probably be offensive to quite a few folks, so I apologize ๐Ÿ˜Š I might improve this in the future as I learn more about ZSH but for now this does the job for me ๐Ÿ˜‰

A big THANK YOU to Jess Frazelle for the inspiration!