Created
July 4, 2012 08:15
-
-
Save joren/3046042 to your computer and use it in GitHub Desktop.
Oh my zsh projects auto complete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT_PATHS=(~/Projects/Openminds ~/Projects/Personal) | |
function project () { | |
cmd="cd" | |
file=$1 | |
if [[ "open" == "$file" ]] then | |
file=$2 | |
cmd=(${(s: :)EDITOR}) | |
fi | |
for project in $PROJECT_PATHS; do | |
if [[ -d $project/$file ]] then | |
$cmd "$project/$file" | |
unset project # Unset project var | |
return | |
fi | |
done | |
echo "No such project $1" | |
} | |
alias p="project" | |
alias m='stt' | |
function _project () { | |
compadd `/bin/ls -l $PROJECT_PATHS | awk '{ print $9 }'` | |
} | |
compdef _project project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment