mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-08 11:34:51 +08:00
Implemented: force python 2 or 3 with ability to switch during runtime
Simultaneous python2 and python3 support, switchable during runtime calling a function as well as setting a variable in .vimrc! Closes issues #200 and #210 (which gave the idea for this commit, thank you @Shtucer).
This commit is contained in:
25
initialize.py
Normal file
25
initialize.py
Normal file
@@ -0,0 +1,25 @@
|
||||
''' ------------------------------------------------------------------------
|
||||
Python initialization
|
||||
---------------------------------------------------------------------------
|
||||
here we initialize the jedi stuff '''
|
||||
|
||||
import vim
|
||||
|
||||
# update the system path, to include the jedi path
|
||||
import sys
|
||||
import os
|
||||
|
||||
# vim.command('echom expand("<sfile>:p:h:h")')
|
||||
sys.path.insert(0, os.path.join(vim.eval('expand("<sfile>:p:h:h")'), 'jedi'))
|
||||
|
||||
# to display errors correctly
|
||||
import traceback
|
||||
|
||||
# update the sys path to include the jedi_vim script
|
||||
sys.path.insert(1, vim.eval('expand("<sfile>:p:h:h")'))
|
||||
try:
|
||||
import jedi_vim
|
||||
except ImportError:
|
||||
vim.command('echoerr "Please install Jedi if you want to use jedi_vim."')
|
||||
sys.path.pop(1)
|
||||
|
||||
Reference in New Issue
Block a user