1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-26 12:10:32 +08:00

Add commands for spacevim

This commit is contained in:
wsdjeg 2017-03-07 23:31:51 +08:00
parent dcd6479e7c
commit 8f526292eb
5 changed files with 62 additions and 4 deletions

View File

@ -348,6 +348,7 @@ function! SpaceVim#default() abort
call SpaceVim#default#SetOptions() call SpaceVim#default#SetOptions()
call SpaceVim#default#SetPlugins() call SpaceVim#default#SetPlugins()
call SpaceVim#default#SetMappings() call SpaceVim#default#SetMappings()
call SpaceVim#commands#load()
endfunction endfunction
function! SpaceVim#defindFuncs() abort 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

@ -74,7 +74,22 @@ function! SpaceVim#logger#viewLog(...) abort
\ . s:levels[l] . "\]'"), "\n") \ . s:levels[l] . "\]'"), "\n")
endif endif
let info .= "\n```\n" let info .= "\n```\n"
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
else
return info return info
endif
else
return info
endif
endfunction endfunction
"" ""

View File

@ -13,6 +13,18 @@ function! SpaceVim#options#list() abort
return list return list
endfunction 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 function! s:execute(cmd) abort
if exists('*execute') if exists('*execute')
return split(execute(a:cmd), "\n") return split(execute(a:cmd), "\n")

View File

@ -18,8 +18,9 @@ wsdjeg *spacevim* *SpaceVim*
CONTENTS *SpaceVim-contents* CONTENTS *SpaceVim-contents*
1. Introduction.............................................|SpaceVim-intro| 1. Introduction.............................................|SpaceVim-intro|
2. CONFIGURATION...........................................|SpaceVim-config| 2. CONFIGURATION...........................................|SpaceVim-config|
3. Functions............................................|SpaceVim-functions| 3. Commands..............................................|SpaceVim-commands|
4. Layers..................................................|SpaceVim-layers| 4. Functions............................................|SpaceVim-functions|
5. Layers..................................................|SpaceVim-layers|
1. Default............................................|SpaceVim-default| 1. Default............................................|SpaceVim-default|
2. autocomplete..................................|SpaceVim-autocomplete| 2. autocomplete..................................|SpaceVim-autocomplete|
3. checkers....................................|SpaceVim-layer-checkers| 3. checkers....................................|SpaceVim-layer-checkers|
@ -41,7 +42,7 @@ CONTENTS *SpaceVim-contents*
19. operator...................................|SpaceVim-layer-operator| 19. operator...................................|SpaceVim-layer-operator|
20. shell.........................................|SpaceVim-layer-shell| 20. shell.........................................|SpaceVim-layer-shell|
21. tmux...........................................|SpaceVim-layer-tmux| 21. tmux...........................................|SpaceVim-layer-tmux|
5. FAQ........................................................|SpaceVim-faq| 6. FAQ........................................................|SpaceVim-faq|
============================================================================== ==============================================================================
INTRODUCTION *SpaceVim-intro* 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 The host file url. This option is for Chinese users who can not use Google and
Twitter. 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* FUNCTIONS *SpaceVim-functions*