From: Adam A.G. Shamblin Date: Wed, 22 May 2013 22:46:31 +0000 (-0600) Subject: Automate sourcing of virtualenvs. X-Git-Url: https://git.vexinglabs.com/?a=commitdiff_plain;h=9a1b748fad3d1d871167c15dd1d6780c98b73ee8;p=dotfiles.git Automate sourcing of virtualenvs. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/dotbash_profile b/dotbash_profile index a617c5e..cacbf3a 100644 --- a/dotbash_profile +++ b/dotbash_profile @@ -12,6 +12,20 @@ function prompt_char { echo '$' } +function activate_env { + + HAS_DEACTIVATE=`type -t deactivate` + + if [ -e env/bin/activate ] && [ "${#VIRTUAL_ENV}" -eq 0 ]; then + source env/bin/activate; + elif [ ! -e env/bin/activate ] && [ "${#HAS_DEACTIVATE}" -ne 0 ]; then + deactivate; + fi + + unset HAS_DEACTIVATE +} +export PROMPT_COMMAND=activate_env + export PS1='\[$ORANGE\]\u\[$RESET\] @ \[$YELLOW\]\h\[$RESET\] in \[$GREEN\]\w\[$RESET\]\n\[$BASE2\]$(prompt_char)\[$RESET\] ' # Extended PYTHONPATH for brew-installed packages diff --git a/dotvimrc b/dotvimrc index 13d89d1..3f34f48 100644 --- a/dotvimrc +++ b/dotvimrc @@ -14,4 +14,6 @@ set noerrorbells set vb set colorcolumn=80 +au BufNewFile,BufRead *.json set filetype=javascript + call pathogen#infect()