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

Merge branch 'commands' into dev

This commit is contained in:
wsdjeg 2017-03-08 20:39:54 +08:00
commit 108520708e
6 changed files with 69 additions and 5 deletions

View File

@ -348,6 +348,7 @@ function! SpaceVim#default() abort
call SpaceVim#default#SetOptions()
call SpaceVim#default#SetPlugins()
call SpaceVim#default#SetMappings()
call SpaceVim#commands#load()
endfunction
function! SpaceVim#defindFuncs() abort

View File

@ -0,0 +1,14 @@
function! SpaceVim#commands#load() abort
""
" Load exist layer, {layers} can be a string of a layer name, or a list
" of layer names.
command! -nargs=+ SPLayer call SpaceVim#layers#load(<f-args>)
""
" Set or check SpaceVim option. {opt} should be the option name of
" spacevim, This command will use [value] as the value of option name.
command! -nargs=+ SPSet call SpaceVim#options#set(<f-args>)
""
" print the debug information of spacevim, [!] forces the output into a
" new buffer.
command! -nargs=0 -bang SPDebugInfo echo SpaceVim#logger#viewLog('<bang>' == '!')
endfunction

View File

@ -5,10 +5,15 @@
""
" 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 index(g:spacevim_plugin_groups, a:layer) == -1
call add(g:spacevim_plugin_groups, a:layer)
endif
if a:0 > 1
for l in a:000
call SpaceVim#layers#load(l)
endfor
endif
endfunction
" vim:set et sw=2:

View File

@ -74,7 +74,23 @@ function! SpaceVim#logger#viewLog(...) abort
\ . s:levels[l] . "\]'"), "\n")
endif
let info .= "\n```\n"
return info
if a:0 > 0
if a:1 == 1
tabnew +setl\ nobuflisted
nnoremap <buffer><silent> q :bd!<CR>
for msg in split(info, "\n")
call append(line('$'), msg)
endfor
normal! "_dd
setl nomodifiable
setl buftype=nofile
setl filetype=markdown
else
return info
endif
else
return info
endif
endfunction
""

View File

@ -13,6 +13,18 @@ function! SpaceVim#options#list() abort
return list
endfunction
function! SpaceVim#options#set(argv, ...) abort
if a:0 > 0
if exists('g:spacevim_' . a:argv)
exe 'let g:spacevim_' . a:argv . '=' . a:1
endif
else
if exists('g:spacevim_' . a:argv)
exe 'echo string(g:spacevim_' . a:argv . ')'
endif
endif
endfunction
function! s:execute(cmd) abort
if exists('*execute')
return split(execute(a:cmd), "\n")

View File

@ -18,8 +18,9 @@ wsdjeg *spacevim* *SpaceVim*
CONTENTS *SpaceVim-contents*
1. Introduction.............................................|SpaceVim-intro|
2. CONFIGURATION...........................................|SpaceVim-config|
3. Functions............................................|SpaceVim-functions|
4. Layers..................................................|SpaceVim-layers|
3. Commands..............................................|SpaceVim-commands|
4. Functions............................................|SpaceVim-functions|
5. Layers..................................................|SpaceVim-layers|
1. Default............................................|SpaceVim-default|
2. autocomplete..................................|SpaceVim-autocomplete|
3. checkers....................................|SpaceVim-layer-checkers|
@ -41,7 +42,7 @@ CONTENTS *SpaceVim-contents*
19. operator...................................|SpaceVim-layer-operator|
20. shell.........................................|SpaceVim-layer-shell|
21. tmux...........................................|SpaceVim-layer-tmux|
5. FAQ........................................................|SpaceVim-faq|
6. FAQ........................................................|SpaceVim-faq|
==============================================================================
INTRODUCTION *SpaceVim-intro*
@ -265,6 +266,21 @@ vim to start up slowly if there are too many files in the current directory.
The host file url. This option is for Chinese users who can not use Google and
Twitter.
==============================================================================
COMMANDS *SpaceVim-commands*
:SPLayer {layers} *:SPLayer*
Load exist layer, {layers} can be a string of a layer name, or a list of
layer names.
:SPSet {opt} [value] *:SPSet*
Set or check SpaceVim option. {opt} should be the option name of spacevim,
This command will use [value] as the value of option name.
:SPDebugInfo[!] *:SPDebugInfo*
print the debug information of spacevim, [!] forces the output into a new
buffer.
==============================================================================
FUNCTIONS *SpaceVim-functions*