1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 02:05:40 +08:00

Add layers docs

This commit is contained in:
wsdjeg 2017-05-09 21:55:01 +08:00
parent e5f9a6efd6
commit cd0b47f769
4 changed files with 58 additions and 0 deletions

View File

@ -6,6 +6,9 @@
""
" Load the {layer} you want. For all the layers SpaceVim supports, see @section(layers).
function! SpaceVim#layers#load(layer, ...) abort
if a:layer == '-l'
call s:list_layers()
endif
if index(g:spacevim_plugin_groups, a:layer) == -1
call add(g:spacevim_plugin_groups, a:layer)
endif
@ -16,4 +19,35 @@ function! SpaceVim#layers#load(layer, ...) abort
endif
endfunction
function! s:list_layers() abort
tabnew SpaceVimLayers
nnoremap <buffer> q :q<cr>
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell
setf SpaceVimLayerManager
nnoremap <silent> <buffer> q :bd<CR>
let info = [
\ 'SpaceVim layers:',
\ '',
\ ]
call setline(1,info + s:find_layers())
setl nomodifiable
endfunction
function! s:find_layers() abort
let layers = SpaceVim#util#globpath(&rtp, "autoload/SpaceVim/layers/**/*.vim")
let pattern = '/autoload/SpaceVim/layers/'
let rst = []
for layer in layers
if layer =~# pattern
let name = layer[matchend(layer, pattern):-5]
let status = index(g:spacevim_plugin_groups, substitute(name, '/', '#','g')) ? 'loaded' : 'not loaded'
let website = 'https://spacevim.org/layers/' . name
call add(rst, name . repeat(' ', 25 - len(name)) . status . repeat(' ', 10) . website)
endif
endfor
return rst
endfunction
" vim:set et sw=2:

View File

@ -16,6 +16,7 @@ function! SpaceVim#layers#default#config() abort
" help mappings
call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1)
call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)

View File

@ -349,6 +349,9 @@ SPC h I | Open SpaceVim GitHub issue page with pre-filled information
#### Available layers
All layers can be easily discovered via `:SPLayer -l` accessible with `SPC h l`.
##### Available packages in Spacemacs
##### New packages from ELPA repositories

View File

@ -0,0 +1,20 @@
if exists('g:_SpaceVimLayerManager_ftplugin')
finish
else
let g:_SpaceVimLayerManager_ftplugin = 1
endif
function! SpaceVimLayerManager#statusline(...)
if &ft ==# 'SpaceVimLayerManager'
call airline#extensions#apply_left_override('SpaceVimLayers', '')
" Alternatively, set the various w:airline_section variables
"let w:airline_section_a = 'SpaceVimPluginManager'
"let w:airline_section_b = ''
"let w:airline_section_c = ''
"let w:airline_render_left = 1
"let w:airline_render_right = 0
endif
endfunction
try
call airline#add_statusline_func('SpaceVimLayerManager#statusline')
catch
endtry