Skip to content

Instantly share code, notes, and snippets.

@SmileyChris
Created December 8, 2010 20:33
Show Gist options
  • Save SmileyChris/733871 to your computer and use it in GitHub Desktop.
Save SmileyChris/733871 to your computer and use it in GitHub Desktop.
~/.virtualenvs/postactivate: switch to working directory initially if it exists, and allow switiching between the env root and the working directory by typing "cd"
WORKDIR=$HOME/work/`basename $VIRTUAL_ENV`
cd () {
if (( $# == 0 )); then
if [ -d $WORKDIR ] && [ `pwd` != $WORKDIR ]; then
builtin cd $WORKDIR
else
builtin cd $VIRTUAL_ENV
fi
else
builtin cd "$@"
fi
}
if [ -d $WORKDIR ]; then
cd $WORKDIR
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment