Created
December 1, 2018 16:27
-
-
Save NickCrew/d079904da560d1ddc8cc39387fead5a5 to your computer and use it in GitHub Desktop.
Vim Virtualenv Support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Add the virtualenv's site-packages to vim path | |
if has('python') | |
py << EOF | |
import os.path | |
import sys | |
import vim | |
if 'VIRTUAL_ENV' in os.environ: | |
project_base_dir = os.environ['VIRTUAL_ENV'] | |
sys.path.insert(0, project_base_dir) | |
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
execfile(activate_this, dict(__file__=activate_this)) | |
EOF | |
endif | |
" Load up virtualenv's vimrc if it exists | |
if filereadable($VIRTUAL_ENV . '/.vimrc') | |
source $VIRTUAL_ENV/.vimrc | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment