1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:10:06 +08:00

Add json example (#1625)

* Add json example

* Add json func

* Add json support
This commit is contained in:
Wang Shidong 2018-04-18 07:40:37 -05:00 committed by GitHub
parent 9a4b0281fe
commit b362f23bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -595,6 +595,13 @@ function! SpaceVim#loadCustomConfig() abort
exe 'source ' . custom_glob_conf
endif
" json config
let json_global = expand('~/.SpaceVim.d/init.json')
if filereadable(json_global)
let config = join(readfile(json_global), '')
call SpaceVim#custom#apply(config)
endif
if g:spacevim_enable_ycm && g:spacevim_snippet_engine !=# 'ultisnips'
call SpaceVim#logger#info('YCM only support ultisnips, change g:spacevim_snippet_engine to ultisnips')
let g:spacevim_snippet_engine = 'ultisnips'

View File

@ -70,3 +70,17 @@ endfunction
function! SpaceVim#custom#SPCGroupName(keys, name) abort
call add(g:_spacevim_mappings_space_custom_group_name, [a:keys, a:name])
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
endfunction
function! SpaceVim#custom#write(force) abort
endfunction

10
mode/basic.json Normal file
View File

@ -0,0 +1,10 @@
{
"colorscheme": "grubox",
"background": "dark",
"guicolors": true,
"statusline_separator": "nil",
"statusline_inactive_separator": "bar",
"buffer_index_type": 4,
"filetype_icon": false,
"statusline_display_mode": false
}