Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Created April 16, 2010 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjaspers/368394 to your computer and use it in GitHub Desktop.
Save pjaspers/368394 to your computer and use it in GitHub Desktop.
Autocomplete zsh projects folder
function go() {
if [[ -e ~/development/rails/$1 ]]; then
cd ~/development/rails/$1
elif [[ -e ~/development/sinatra/$1 ]]; then
cd ~/development/sinatra/$1
elif [[ -e ~/development/objc/$1 ]]; then
cd ~/development/objc/$1
elif [[ -e ~/development/php/$1 ]]; then
cd ~/development/php/$1
elif [[ -e ~/development/ruby/$1 ]]; then
cd ~/development/ruby/$1
else
cd
fi
}
_go_list_need_generating () {
if [ ! -f ~/.projectlist~ ]; then return 0;
else
return 1;
fi
}
_go () {
if _go_list_need_generating; then
echo "\nGenerating ~/.projectlist~..." > /dev/stderr
for f in ~/development/*; do ls $f | cat >> ~/.projectlist~; done
fi
compadd `cat ~/.projectlist~`
}
compdef _go go
@johnjohndoe
Copy link

@To1ne Please add a README to the folder of oh-my-zsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment