]> Vexing Labs - dotfiles.git/commitdiff
Automate sourcing of virtualenvs.
authorAdam A.G. Shamblin <adam.shamblin@gmail.com>
Wed, 22 May 2013 22:46:31 +0000 (16:46 -0600)
committerAdam A.G. Shamblin <adam.shamblin@gmail.com>
Wed, 22 May 2013 22:46:31 +0000 (16:46 -0600)
.gitignore [new file with mode: 0644]
dotbash_profile
dotvimrc

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..1377554
--- /dev/null
@@ -0,0 +1 @@
+*.swp
index a617c5e71f229bf4209baa985b6584d15ae29feb..cacbf3a5e5a16db7c16dcf2e2a783cde0113776f 100644 (file)
@@ -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
index 13d89d1550b3212ae4f74e0b74566c57417364f1..3f34f4804f381ed0af0118d362abfab81f556df7 100644 (file)
--- 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()