mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 05:20:04 +08:00
Merge pull request #1236 from SpaceVim/if_python
Improve if_python check in SpaceVim close #1232
This commit is contained in:
commit
afd420b515
@ -1,7 +1,8 @@
|
||||
let s:self = {}
|
||||
|
||||
let s:CMP = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
if has('python')
|
||||
if s:CMP.has('python')
|
||||
" @vimlint(EVL103, 1, a:text)
|
||||
function! s:self.encode(text) abort
|
||||
py import vim
|
||||
@ -116,7 +117,7 @@ endif
|
||||
|
||||
|
||||
|
||||
function! SpaceVim#api#data#base64#get()
|
||||
function! SpaceVim#api#data#base64#get() abort
|
||||
|
||||
return deepcopy(s:self)
|
||||
|
||||
|
@ -4,6 +4,7 @@ function! SpaceVim#api#vim#compatible#get() abort
|
||||
\ 'system' : '',
|
||||
\ 'systemlist' : '',
|
||||
\ 'version' : '',
|
||||
\ 'has' : '',
|
||||
\ 'globpath' : '',
|
||||
\ },
|
||||
\ "function('s:' . v:key)"
|
||||
@ -111,4 +112,32 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
function! s:has(feature) abort
|
||||
if a:feature ==# 'python'
|
||||
try
|
||||
py import vim
|
||||
return 1
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
elseif a:feature ==# 'python3'
|
||||
try
|
||||
py3 import vim
|
||||
return 1
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
elseif a:feature ==# 'pythonx'
|
||||
try
|
||||
pyx import vim
|
||||
return 1
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
else
|
||||
return has(a:feature)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
Loading…
Reference in New Issue
Block a user