From 9a1b748fad3d1d871167c15dd1d6780c98b73ee8 Mon Sep 17 00:00:00 2001 From: "Adam A.G. Shamblin" Date: Wed, 22 May 2013 16:46:31 -0600 Subject: [PATCH] Automate sourcing of virtualenvs. --- .gitignore | 1 + dotbash_profile | 14 ++++++++++++++ dotvimrc | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 .gitignore 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() -- 2.39.5