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:
parent
e5f9a6efd6
commit
cd0b47f769
@ -6,6 +6,9 @@
|
|||||||
""
|
""
|
||||||
" 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).
|
||||||
function! SpaceVim#layers#load(layer, ...) abort
|
function! SpaceVim#layers#load(layer, ...) abort
|
||||||
|
if a:layer == '-l'
|
||||||
|
call s:list_layers()
|
||||||
|
endif
|
||||||
if index(g:spacevim_plugin_groups, a:layer) == -1
|
if index(g:spacevim_plugin_groups, a:layer) == -1
|
||||||
call add(g:spacevim_plugin_groups, a:layer)
|
call add(g:spacevim_plugin_groups, a:layer)
|
||||||
endif
|
endif
|
||||||
@ -16,4 +19,35 @@ function! SpaceVim#layers#load(layer, ...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
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:
|
" vim:set et sw=2:
|
||||||
|
@ -16,6 +16,7 @@ function! SpaceVim#layers#default#config() abort
|
|||||||
" help mappings
|
" 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'], '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', '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', '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', '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)
|
call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1)
|
||||||
|
@ -349,6 +349,9 @@ SPC h I | Open SpaceVim GitHub issue page with pre-filled information
|
|||||||
|
|
||||||
#### Available layers
|
#### Available layers
|
||||||
|
|
||||||
|
All layers can be easily discovered via `:SPLayer -l` accessible with `SPC h l`.
|
||||||
|
|
||||||
|
|
||||||
##### Available packages in Spacemacs
|
##### Available packages in Spacemacs
|
||||||
|
|
||||||
##### New packages from ELPA repositories
|
##### New packages from ELPA repositories
|
||||||
|
20
ftplugin/SpaceVimLayerManager.vim
Normal file
20
ftplugin/SpaceVimLayerManager.vim
Normal 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
|
Loading…
x
Reference in New Issue
Block a user