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

fix(command): fix SPLayer command

This commit is contained in:
wsdjeg 2022-06-19 19:51:51 +08:00
parent 5f2e2cf68e
commit 075d92f92a
2 changed files with 7 additions and 3 deletions

View File

@ -65,7 +65,11 @@ let s:CMP = SpaceVim#api#import('vim#compatible')
" <
function! SpaceVim#layers#load(layer, ...) abort
if a:layer ==# '-l'
call s:list_layers()
if has('nvim')
lua require('spacevim.layer').load('-l')
else
call s:list_layers()
endif
return
elseif empty(a:layer) || type(a:layer) !=# type('')
return

View File

@ -48,7 +48,7 @@ local function find_layers()
else
url = name
end
if sp.fn.filereadable(sp.fn.expand('~/.SpaceVim/docs/layers/' .. url .. '.md')) then
if sp.fn.filereadable(sp.fn.expand('~/.SpaceVim/docs/layers/' .. url .. '.md')) == 1 then
website = 'https://spacevim.org/layers/' .. url .. '/'
else
website = 'no exists'
@ -57,7 +57,7 @@ local function find_layers()
if status == 'loaded' then
table.insert(rst, '+ ' .. name .. ':' .. sp.fn['repeat'](' ', 25 - sp.fn.len(name)) .. status .. sp.fn['repeat'](' ', 10) .. website)
else
table.insert(rst, '- ' .. name .. ':' .. sp.fn['repeat'](' ', 25 - sp.fn.len(name)) .. status .. sp.fn['repeat'](' ', 10) .. website)
table.insert(rst, '- ' .. name .. ':' .. sp.fn['repeat'](' ', 21 - sp.fn.len(name)) .. status .. sp.fn['repeat'](' ', 10) .. website)
end
end
return rst