Permalink
Browse files

Jump into project directories with workon

  • Loading branch information...
1 parent a0e5d7d commit a1d78f789722395eab76a5955a35ff444a6a67bd @dcramer committed Aug 24, 2013
Showing with 16 additions and 2 deletions.
  1. +1 −1 bash/bashrc
  2. +11 −1 virtualenvwrapper/postactivate
  3. +4 −0 virtualenvwrapper/postdeactivate
View
@@ -163,7 +163,7 @@ alias pgsql_stop='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
alias es_start='launchctl stop org.elasticsearch'
alias es_stop='launchctl start org.elasticsearch'
-alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
+alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias scpresume='rsync --partial --progress --progress --stats'
@@ -1,4 +1,14 @@
#!/bin/bash
# This hook is run after every virtualenv is activated.
-export PS1=$PROMPT
+export PS1=$PROMPT
+
+PROJECT_DIR="$HOME/Development/$(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`
+ cd "$PROJECT_DIR"
+ fi
+fi
+unset PROJECT_DIR
@@ -1,3 +1,7 @@
#!/bin/bash
# This hook is run after every virtualenv is deactivated.
+if [ $PRE_VENV_ACTIVATE_DIR ]; then
+ cd $PRE_VENV_ACTIVATE_DIR
+ unset PRE_VENV_ACTIVATE_DIR
+fi

0 comments on commit a1d78f7

Please sign in to comment.