From 2c8a3af9a83c63d371a5ba6463230e5e02b8e875 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 22 Oct 2016 09:11:18 +0300 Subject: [PATCH] (Re)activate python virtual environment --- .shellrc | 4 ++++ .vimrc | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.shellrc b/.shellrc index e21f720..55dab97 100644 --- a/.shellrc +++ b/.shellrc @@ -161,6 +161,10 @@ if test -n "$BASH_VERSION"; then source virtualenvwrapper_lazy.sh 2>/dev/null + #if [ -n "$VIRTUAL_ENV" ]; then + # . "$VIRTUAL_ENV/bin/activate" + #fi + elif test -n "$KSH_VERSION" -o -n "$FCEDIT"; then back() { cd - "$@"; } j() { jobs; } diff --git a/.vimrc b/.vimrc index bad48fd..852d3cb 100644 --- a/.vimrc +++ b/.vimrc @@ -527,6 +527,19 @@ if exists("$SLOWTERM") endif +if has("python") +python << END_OF_PYTHON +import sys, os + +virtualenv_dir = os.environ.get('VIRTUAL_ENV') +if virtualenv_dir: + sys.path.insert(0, virtualenv_dir) + activate_this = os.path.join(virtualenv_dir, 'bin', 'activate_this.py') + execfile(activate_this, dict(__file__=activate_this)) +END_OF_PYTHON +endif + + " ---------- " From http://slobin.pp.ru/vim/_vimrc.html -- 2.39.2