1
0
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:
Wang Shidong 2018-01-04 07:52:36 -06:00 committed by GitHub
commit afd420b515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 2 deletions

View File

@ -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)

View File

@ -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: