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

Fix layer list in windows

This commit is contained in:
Shidong Wang 2018-12-09 10:33:38 +08:00
parent ace3796900
commit 6ee912bee9

View File

@ -13,6 +13,9 @@
let s:enabled_layers = []
let s:layers_vars = {}
let s:SYS = SpaceVim#api#import('system')
""
" Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers).
" the second argv is the layer variable.
@ -60,17 +63,22 @@ endfunction
function! s:find_layers() abort
let layers = SpaceVim#util#globpath(&rtp, 'autoload/SpaceVim/layers/**/*.vim')
let pattern = '/autoload/SpaceVim/layers/'
let pattern = s:SYS.isWindows ? '\\autoload\\SpaceVim\\layers\\' : '/autoload/SpaceVim/layers/'
let rst = []
for layer in layers
if layer =~# pattern
let name = layer[matchend(layer, pattern):-5]
if s:SYS.isWindows
let name = substitute(layer[matchend(layer, pattern):-5], '\\', '/', 'g')
else
let name = layer[matchend(layer, pattern):-5]
endif
let status = (index(s:enabled_layers, substitute(name, '/', '#','g')) != -1) ? 'loaded' : 'not loaded'
if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md'))
let website = 'https://spacevim.org/layers/' . name
let website = 'https://spacevim.org/layers/' . name . '/'
else
let website = 'no exists'
endif
let name = substitute(name, '/', '#','g')
if status ==# 'loaded'
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
else