From: Oleg Broytman Date: Sat, 22 Oct 2016 06:11:18 +0000 (+0300) Subject: (Re)activate python virtual environment X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=2c8a3af9a83c63d371a5ba6463230e5e02b8e875;p=dotfiles.git (Re)activate python virtual environment --- 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