Created
October 8, 2012 04:06
-
-
Save cyeong/3850668 to your computer and use it in GitHub Desktop.
change cd behavior after activate
This file contains 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
One handy hook I use is to overwrite some shell buildins. For example I have a custom cd, you can do so much with totally localized environments. | |
proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}') | |
#this function will overwrite the default behavior of cd to go to the root of the venv, to go to HOME use cd ~ | |
#change postdeactivate as well if you use this hook to revert cd back to ~ | |
cd () { | |
if (( $# == 0 )) | |
then | |
builtin cd ~/projects/$proj_name | |
else | |
builtin cd "$@" | |
fi | |
} | |
#move into the venv after activated | |
cd | |
ctags -f $VIRTUAL_ENV/tags -R $VIRTUAL_ENV/lib/python2.7/site-packages ${PWD} &> /dev/null & disown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment