mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 02:50:03 +08:00
Fix layer list in windows
This commit is contained in:
parent
ace3796900
commit
6ee912bee9
@ -13,6 +13,9 @@
|
|||||||
let s:enabled_layers = []
|
let s:enabled_layers = []
|
||||||
let s:layers_vars = {}
|
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).
|
" Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers).
|
||||||
" the second argv is the layer variable.
|
" the second argv is the layer variable.
|
||||||
@ -60,17 +63,22 @@ endfunction
|
|||||||
|
|
||||||
function! s:find_layers() abort
|
function! s:find_layers() abort
|
||||||
let layers = SpaceVim#util#globpath(&rtp, 'autoload/SpaceVim/layers/**/*.vim')
|
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 = []
|
let rst = []
|
||||||
for layer in layers
|
for layer in layers
|
||||||
if layer =~# pattern
|
if layer =~# pattern
|
||||||
|
if s:SYS.isWindows
|
||||||
|
let name = substitute(layer[matchend(layer, pattern):-5], '\\', '/', 'g')
|
||||||
|
else
|
||||||
let name = layer[matchend(layer, pattern):-5]
|
let name = layer[matchend(layer, pattern):-5]
|
||||||
|
endif
|
||||||
let status = (index(s:enabled_layers, substitute(name, '/', '#','g')) != -1) ? 'loaded' : 'not loaded'
|
let status = (index(s:enabled_layers, substitute(name, '/', '#','g')) != -1) ? 'loaded' : 'not loaded'
|
||||||
if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md'))
|
if filereadable(expand('~/.SpaceVim/docs/layers/' . name . '.md'))
|
||||||
let website = 'https://spacevim.org/layers/' . name
|
let website = 'https://spacevim.org/layers/' . name . '/'
|
||||||
else
|
else
|
||||||
let website = 'no exists'
|
let website = 'no exists'
|
||||||
endif
|
endif
|
||||||
|
let name = substitute(name, '/', '#','g')
|
||||||
if status ==# 'loaded'
|
if status ==# 'loaded'
|
||||||
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
|
call add(rst, '+ ' . name . ':' . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user