Do not barf more than once when python is not found. Patch by blueyed.
This commit is contained in:
commit
15f39c0801
@ -8,14 +8,30 @@ 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
|
||||
" using a copy of vim without python support) it will cause an error anytime a
|
||||
" new file is opened.
|
||||
" ftdetect/UltiSnips.vim and plugin/UltiSnips.vim.
|
||||
" If the function isn't defined (probably due to using a copy of vim
|
||||
" without python support) it would cause an error.
|
||||
function! UltiSnips#FileTypeChanged()
|
||||
endfunction
|
||||
function! UltiSnips#CursorMoved()
|
||||
endfunction
|
||||
function! UltiSnips#CursorMoved()
|
||||
endfunction
|
||||
function! UltiSnips#LeavingBuffer()
|
||||
endfunction
|
||||
function! UltiSnips#LeavingInsertMode()
|
||||
endfunction
|
||||
|
||||
call UltiSnips#bootstrap#Bootstrap()
|
||||
if !exists("g:_uspy")
|
||||
" Delete the autocommands defined in plugin/UltiSnips.vim and
|
||||
" ftdetect/UltiSnips.vim.
|
||||
augroup UltiSnips
|
||||
au!
|
||||
augroup END
|
||||
augroup UltiSnipsFileType
|
||||
au!
|
||||
augroup END
|
||||
finish
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ function! UltiSnips#bootstrap#Bootstrap()
|
||||
echo "UltiSnips requires py >= 2.6 or any py3"
|
||||
endif
|
||||
unlet g:_uspy
|
||||
finish
|
||||
return
|
||||
endif
|
||||
let g:_uspy=":py "
|
||||
endif
|
||||
|
@ -1,6 +1,11 @@
|
||||
call UltiSnips#bootstrap#Bootstrap()
|
||||
|
||||
function! UltiSnips#map_keys#MapKeys()
|
||||
if !exists('g:_uspy')
|
||||
" Do not map keys if bootstrapping failed (e.g. no Python).
|
||||
return
|
||||
endif
|
||||
|
||||
" Map the keys correctly
|
||||
if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
" This has to be called before ftplugins are loaded. Therefore
|
||||
" it is here in ftdetect though it maybe shouldn't
|
||||
if has("autocmd")
|
||||
augroup UltiSnipsFileType
|
||||
au!
|
||||
autocmd FileType * call UltiSnips#FileTypeChanged()
|
||||
augroup END
|
||||
endif
|
||||
|
@ -57,10 +57,13 @@ function! UltiSnips_Anon(...)
|
||||
return call(function('UltiSnips#Anon'), a:000)
|
||||
endfunction
|
||||
|
||||
augroup UltiSnips
|
||||
au!
|
||||
au CursorMovedI * call UltiSnips#CursorMoved()
|
||||
au CursorMoved * call UltiSnips#CursorMoved()
|
||||
au BufLeave * call UltiSnips#LeavingBuffer()
|
||||
au InsertLeave * call UltiSnips#LeavingInsertMode()
|
||||
augroup END
|
||||
|
||||
call UltiSnips#map_keys#MapKeys()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user