parent
cecc7aad88
commit
2d18d53656
@ -5,6 +5,7 @@
|
||||
if exists('did_UltiSnips_autoload') || &cp || version < 700
|
||||
finish
|
||||
endif
|
||||
let did_UltiSnips_autoload=1
|
||||
|
||||
" Define dummy version of function called by autocommand setup in
|
||||
" ftdetect/UltiSnips.vim. If the function isn't defined (probably due to
|
||||
@ -13,26 +14,10 @@ endif
|
||||
function! UltiSnips#FileTypeChanged()
|
||||
endfunction
|
||||
|
||||
if !exists("g:UltiSnipsUsePythonVersion")
|
||||
let g:_uspy=":py3 "
|
||||
if !has("python3")
|
||||
if !has("python")
|
||||
if !exists("g:UltiSnipsNoPythonWarning")
|
||||
echo "UltiSnips requires py >= 2.6 or any py3"
|
||||
endif
|
||||
finish
|
||||
endif
|
||||
let g:_uspy=":py "
|
||||
endif
|
||||
let g:UltiSnipsUsePythonVersion = "<tab>"
|
||||
else
|
||||
if g:UltiSnipsUsePythonVersion == 2
|
||||
let g:_uspy=":py "
|
||||
else
|
||||
let g:_uspy=":py3 "
|
||||
endif
|
||||
endif
|
||||
|
||||
call UltiSnips#bootstrap#Bootstrap()
|
||||
if !exists("g:_uspy")
|
||||
finish
|
||||
end
|
||||
|
||||
" FUNCTIONS {{{
|
||||
function! s:compensate_for_pum()
|
||||
@ -176,13 +161,3 @@ function! UltiSnips#LeavingInsertMode()
|
||||
exec g:_uspy "UltiSnips_Manager._leaving_insert_mode()"
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
" Expand our path
|
||||
exec g:_uspy "import vim, os, sys"
|
||||
exec g:_uspy "new_path = os.path.abspath(os.path.join(
|
||||
\ vim.eval('expand(\"<sfile>:h\")'), '..', 'pythonx'))"
|
||||
exec g:_uspy "vim.command(\"let g:UltiSnipsPythonPath = '%s'\" % new_path)"
|
||||
exec g:_uspy "if not hasattr(vim, 'VIM_SPECIAL_PATH'): sys.path.append(new_path)"
|
||||
exec g:_uspy "from UltiSnips import UltiSnips_Manager"
|
||||
|
||||
let did_UltiSnips_autoload=1
|
||||
|
@ -1,5 +1,40 @@
|
||||
" Kludge to make sure that this file is really run.
|
||||
function! UltiSnips#variables#WasRun()
|
||||
let s:SourcedFile=expand("<sfile>")
|
||||
|
||||
function! UltiSnips#bootstrap#Bootstrap()
|
||||
if exists('did_UltiSnips_bootstrap')
|
||||
return
|
||||
endif
|
||||
let did_UltiSnips_bootstrap=1
|
||||
|
||||
if !exists("g:UltiSnipsUsePythonVersion")
|
||||
let g:_uspy=":py3 "
|
||||
if !has("python3")
|
||||
if !has("python")
|
||||
if !exists("g:UltiSnipsNoPythonWarning")
|
||||
echo "UltiSnips requires py >= 2.6 or any py3"
|
||||
endif
|
||||
finish
|
||||
endif
|
||||
let g:_uspy=":py "
|
||||
endif
|
||||
let g:UltiSnipsUsePythonVersion = "<tab>"
|
||||
else
|
||||
if g:UltiSnipsUsePythonVersion == 2
|
||||
let g:_uspy=":py "
|
||||
else
|
||||
let g:_uspy=":py3 "
|
||||
endif
|
||||
endif
|
||||
|
||||
" Expand our path
|
||||
exec g:_uspy "import vim, os, sys"
|
||||
exec g:_uspy "sourced_file = vim.eval('s:SourcedFile')"
|
||||
exec g:_uspy "while not os.path.exists(os.path.join(sourced_file, 'pythonx')):
|
||||
\ sourced_file = os.path.dirname(sourced_file)"
|
||||
exec g:_uspy "module_path = os.path.join(sourced_file, 'pythonx')"
|
||||
exec g:_uspy "vim.command(\"let g:UltiSnipsPythonPath = '%s'\" % module_path)"
|
||||
exec g:_uspy "if not hasattr(vim, 'VIM_SPECIAL_PATH'): sys.path.append(module_path)"
|
||||
exec g:_uspy "from UltiSnips import UltiSnips_Manager"
|
||||
endfunction
|
||||
|
||||
" The trigger used to expand a snippet.
|
@ -1,4 +1,4 @@
|
||||
call UltiSnips#variables#WasRun()
|
||||
call UltiSnips#bootstrap#Bootstrap()
|
||||
|
||||
function! UltiSnips#map_keys#MapKeys()
|
||||
" Map the keys correctly
|
||||
|
Loading…
x
Reference in New Issue
Block a user