1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

refactor(api): remove SpaceVim#util#globpath function

use `vim#compatible` api
This commit is contained in:
wsdjeg 2022-04-15 17:13:41 +08:00
parent 2eadc4c439
commit ca88eed294
7 changed files with 20 additions and 11 deletions

View File

@ -10,6 +10,7 @@ scriptencoding utf-8
let s:FILE = SpaceVim#api#import('file')
let s:SYS = SpaceVim#api#import('system')
let s:CMP = SpaceVim#api#import('vim#compatible')
let s:AUTODOC = SpaceVim#api#import('dev#autodoc')
@ -45,7 +46,7 @@ function! s:generate_content() abort
endfunction
function! s:api_list() abort
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/api/**/*.md')
let layers = s:CMP.globpath('~/.SpaceVim/', 'docs/api/**/*.md')
let list = [
\ '| Name | Description |',
\ '| ---------- | ------------ |'
@ -70,7 +71,7 @@ function! s:api_list() abort
endfunction
function! s:api_list_cn() abort
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/cn/api/**/*.md')
let layers = s:CMP.globpath('~/.SpaceVim/', 'docs/cn/api/**/*.md')
let list = [
\ '| 名称 | 描述 |',
\ '| ---------- | ------------ |'

View File

@ -10,6 +10,7 @@ scriptencoding utf-8
let s:FILE = SpaceVim#api#import('file')
let s:SYS = SpaceVim#api#import('system')
let s:CMP = SpaceVim#api#import('vim#compatible')
@ -73,7 +74,7 @@ function! s:generate_content_cn() abort
endfunction
function! s:generate_docker_content() abort
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/cn/layers/**/*.md')
let layers = s:CMP.globpath('~/.SpaceVim/', 'docs/cn/layers/**/*.md')
let list = [
\ ]
call remove(layers, index(layers, '/home/wsdjeg/.SpaceVim/docs/cn/layers/index.md'))
@ -90,7 +91,7 @@ function! s:generate_docker_content() abort
endfunction
function! s:layer_list() abort
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/layers/**/*.md')
let layers = s:CMP.globpath('~/.SpaceVim/', 'docs/layers/**/*.md')
let list = [
\ '| Name | Description |',
\ '| ---------- | ------------ |'
@ -115,7 +116,7 @@ function! s:layer_list() abort
endfunction
function! s:layer_list_cn() abort
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/cn/layers/**/*.md')
let layers = s:CMP.globpath('~/.SpaceVim/', 'docs/cn/layers/**/*.md')
let list = [
\ '| 名称 | 描述 |',
\ '| ---------- | ------------ |'

View File

@ -6,8 +6,11 @@
" License: GPLv3
"=============================================================================
let s:CMP = SpaceVim#api#import('vim#compatible')
function! SpaceVim#health#report() abort
let items = map(SpaceVim#util#globpath(&rtp,'autoload/SpaceVim/health/*'), "fnamemodify(v:val,':t:r')")
let items = map(s:CMP.globpath(&rtp,'autoload/SpaceVim/health/*'), "fnamemodify(v:val,':t:r')")
let report = []
for item in items
try

View File

@ -51,6 +51,7 @@ let s:layers_vars = {}
let s:SYS = SpaceVim#api#import('system')
let s:CMP = SpaceVim#api#import('vim#compatible')
""
" Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers).
@ -120,7 +121,7 @@ function! s:list_layers() abort
endfunction
function! s:find_layers() abort
let layers = SpaceVim#util#globpath(&rtp, 'autoload/SpaceVim/layers/**/*.vim')
let layers = s:CMP.globpath(&rtp, 'autoload/SpaceVim/layers/**/*.vim')
let pattern = s:SYS.isWindows ? '\\autoload\\SpaceVim\\layers\\' : '/autoload/SpaceVim/layers/'
let rst = []
for layer in layers
@ -179,7 +180,7 @@ endfunction
function! SpaceVim#layers#list() abort
let files = SpaceVim#util#globpath('.', 'autoload/SpaceVim/layers/**/*.vim')
let files = s:CMP.globpath('.', 'autoload/SpaceVim/layers/**/*.vim')
let pattern = s:SYS.isWindows ? '\\autoload\\SpaceVim\\layers\\' : '/autoload/SpaceVim/layers/'
let layers = []
for file in files

View File

@ -45,6 +45,7 @@ endif
let s:JOB = SpaceVim#api#import('job')
let s:NUM = SpaceVim#api#import('data#number')
let s:CMP = SpaceVim#api#import('vim#compatible')
function! SpaceVim#layers#tools#mpv#config() abort
@ -90,7 +91,7 @@ function! SpaceVim#layers#tools#mpv#play(fpath) abort
endfunction
function! s:load_musics() abort
let musics = SpaceVim#util#globpath(s:musics_directory, '*.mp3')
let musics = s:CMP.globpath(s:musics_directory, '*.mp3')
let g:unite_source_menu_menus.MpvPlayer.command_candidates = []
for m in musics
call add(g:unite_source_menu_menus.MpvPlayer.command_candidates,

View File

@ -5,7 +5,7 @@
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:CPT = SpaceVim#api#import('vim#compatible')
let s:CMP = SpaceVim#api#import('vim#compatible')
function! SpaceVim#options#list() abort
let list = []
@ -15,7 +15,7 @@ function! SpaceVim#options#list() abort
endfor
else
redraw
for var in filter(map(split(s:CPT.execute('let g:'), "\n"), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
for var in filter(map(split(s:CMP.execute('let g:'), "\n"), "matchstr(v:val, '\\S\\+')"), "v:val =~# '^spacevim_'")
call add(list, ' ' . var[11:] . ' = ' . string(get(g:, var , '')))
endfor
endif

View File

@ -10,7 +10,9 @@ let s:SYSTEM = SpaceVim#api#import('system')
let s:FILE = SpaceVim#api#import('file')
" @deprecated SpaceVim#util#globpath is deprecated
function! SpaceVim#util#globpath(path, expr) abort
call SpaceVim#logger#warn('SpaceVim#util#globpath will be removed in next release.')
if has('patch-7.4.279')
return globpath(a:path, a:expr, 1, 1)
else