Created
November 13, 2013 08:15
-
-
Save billyshambrook/7445488 to your computer and use it in GitHub Desktop.
Virtualenvwrapper postactivate
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
#!/bin/zsh | |
# Global virtualenvwrapper postactivate, lives in $WORKON_HOME/postactivate | |
# Remove virtual env from start of PS1 as it's in RPROMPT instead | |
PS1="$_OLD_VIRTUAL_PS1" | |
PROJECT_DIR="$HOME/projects/$(basename $VIRTUAL_ENV)" | |
if [ -d $PROJECT_DIR ]; then | |
# If we aren't already within the project dir, cd into it | |
if [[ ! `pwd` == "$PROJECT_DIR*" ]]; then | |
export PRE_VENV_ACTIVATE_DIR=`pwd` | |
export CURRENT_PROJECT="$PROJECT_DIR" | |
cd "$PROJECT_DIR" | |
fi | |
fi | |
unset PROJECT_DIR% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment