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

Improve toml support

This commit is contained in:
wsdjeg 2018-04-23 20:37:15 +08:00
parent eac74ec4a0
commit 95f27aaf20
2 changed files with 13 additions and 7 deletions

View File

@ -76,12 +76,18 @@ endfunction
function! SpaceVim#custom#apply(config) abort
let config = json_decode(a:config)
for key in keys(config)
if exists('g:spacevim_' . key)
exe 'let g:spacevim_' . key . ' = "' . config[key] . '"'
endif
endfor
if type(a:config) != type({})
call SpaceVim#logger#info('config type is wrong!')
else
let options = get(a:config, 'options', {})
for [name, value] in items(options)
exe 'let g:spacevim_' . name . ' = value'
endfor
let layers = get(a:config, 'layers', {})
for layer in layers
call SpaceVim#layers#load(layer.name, layer)
endfor
endif
endfunction
function! SpaceVim#custom#write(force) abort

View File

@ -1,7 +1,7 @@
# This is basic configuration example for SpaceVim
# All SpaceVim option below [option] section
[option]
[options]
# set spacevim theme. by default colorscheme layer is not loaded,
# if you want to use more colorscheme, please load the colorscheme
# layer