Skip to content

Instantly share code, notes, and snippets.

@billyshambrook
Created November 13, 2013 08:15
Show Gist options
  • Save billyshambrook/7445488 to your computer and use it in GitHub Desktop.
Save billyshambrook/7445488 to your computer and use it in GitHub Desktop.
Virtualenvwrapper postactivate
#!/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