-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add virtualenv support #31
Comments
I think it is impossible. |
I have this in my vimrc, I don't think you need more for virtualenv support for any plugin: " 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
|
Related to davidhalter/jedi#36. The approach by @strycore looks pretty good to me. There are other ways to check whether the current interpreter session is a virtualenv, but that won't help here as we have to detect a virtualenv from outside. The environment variable is not 100% reliable, but probably the best solution we can find. @strycore It appears that the vim import is unnecessary, am I right? Or does it have some side effects? |
Please try and test, I don't really use virtualenv. |
@davidhalter You don't? Are you crazy? :) I'll test this tonight, thanks. |
@gwrtheyrn Crazy? Lazy would be the right word :-) |
@davidhalter i'm not @gwrtheyrn anymore, so i guess i don't have to deal with this :p (no, i'll try to test this tonight, really.) |
Seems to work OK :) Thanks! |
virtualenv support is now being mentioned here: |
More detail to: davidhalter/jedi-vim#31.
from: davidhalter/jedi-vim#31 (comment) strycore's issue comment
See #685 |
On switching virtualenv/interpreter do reinitialize python stuff.
When I start vim, jedi use system python interpreter
But I used VirutalEnv vim plugin for switching per project.
I have many projects in tabs for one vim instance.
To solve this issue I wrote simple function for reimporting jedi lib and jedi_vim files in new virtualenv
Sorry for my poor English (
The text was updated successfully, but these errors were encountered: