1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 14:50:04 +08:00
This commit is contained in:
wsdjeg 2018-01-04 21:34:23 +08:00
parent 57b6589c6f
commit 81aec3c393
2 changed files with 32 additions and 2 deletions

View File

@ -1,7 +1,8 @@
let s:self = {} let s:self = {}
let s:CMP = SpaceVim#api#import('vim#compatible')
if has('python') if s:CMP.has('python')
" @vimlint(EVL103, 1, a:text) " @vimlint(EVL103, 1, a:text)
function! s:self.encode(text) abort function! s:self.encode(text) abort
py import vim 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) return deepcopy(s:self)

View File

@ -4,6 +4,7 @@ function! SpaceVim#api#vim#compatible#get() abort
\ 'system' : '', \ 'system' : '',
\ 'systemlist' : '', \ 'systemlist' : '',
\ 'version' : '', \ 'version' : '',
\ 'has' : '',
\ 'globpath' : '', \ 'globpath' : '',
\ }, \ },
\ "function('s:' . v:key)" \ "function('s:' . v:key)"
@ -111,4 +112,32 @@ else
endfunction endfunction
endif 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: " vim:set et sw=2 cc=80: