forked from VimPlug/jedi-vim
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).
26 lines
722 B
Python
26 lines
722 B
Python
''' ------------------------------------------------------------------------
|
|
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)
|
|
|