mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:00:05 +08:00
fix(bootstrap): skip error in toml file
This commit is contained in:
parent
ec0756f309
commit
f0ca1bc6c5
@ -21,7 +21,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:set(key,val) abort
|
function! s:set(key,val) abort
|
||||||
if !exists('g:spacevim_' . a:key)
|
if !exists('g:spacevim_' . a:key)
|
||||||
call SpaceVim#logger#warn('unsupported option: ' . a:key)
|
call SpaceVim#logger#warn('unsupported option: ' . a:key, 0)
|
||||||
else
|
else
|
||||||
exe 'let ' . 'g:spacevim_' . a:key . '=' . a:val
|
exe 'let ' . 'g:spacevim_' . a:key . '=' . a:val
|
||||||
endif
|
endif
|
||||||
@ -73,7 +73,7 @@ function! s:write_to_config(config) abort
|
|||||||
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
||||||
let cf = global_dir . 'init.toml'
|
let cf = global_dir . 'init.toml'
|
||||||
if filereadable(cf)
|
if filereadable(cf)
|
||||||
call SpaceVim#logger#warn('The file already exists:' . cf)
|
call SpaceVim#logger#warn('The file already exists:' . cf, 0)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let dir = expand(fnamemodify(cf, ':p:h'))
|
let dir = expand(fnamemodify(cf, ':p:h'))
|
||||||
@ -112,8 +112,8 @@ endfunction
|
|||||||
""
|
""
|
||||||
" function for adding custom leader key bindings
|
" function for adding custom leader key bindings
|
||||||
function! SpaceVim#custom#leader(type, key, value, ...) abort
|
function! SpaceVim#custom#leader(type, key, value, ...) abort
|
||||||
call add(g:_spacevim_mappings_leader_custom,
|
call add(g:_spacevim_mappings_leader_custom,
|
||||||
\ [a:type, a:key, a:value] + a:000)
|
\ [a:type, a:key, a:value] + a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
""
|
""
|
||||||
@ -196,7 +196,7 @@ function! s:apply(config, type) abort
|
|||||||
elseif has_key(plugin, 'name')
|
elseif has_key(plugin, 'name')
|
||||||
call add(g:spacevim_custom_plugins, [plugin.name, plugin])
|
call add(g:spacevim_custom_plugins, [plugin.name, plugin])
|
||||||
else
|
else
|
||||||
call SpaceVim#logger#warn('custom_plugins should contains repo key!')
|
call SpaceVim#logger#warn('custom_plugins should contains repo key!', 0)
|
||||||
call SpaceVim#logger#info(string(plugin))
|
call SpaceVim#logger#info(string(plugin))
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -306,15 +306,19 @@ function! s:load_local_conf() abort
|
|||||||
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
|
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
|
||||||
call s:apply(conf, 'local')
|
call s:apply(conf, 'local')
|
||||||
else
|
else
|
||||||
let conf = s:TOML.parse_file(local_conf)
|
try
|
||||||
let dir = s:FILE.unify_path(expand(g:spacevim_data_dir
|
let conf = s:TOML.parse_file(local_conf)
|
||||||
\ . 'SpaceVim/conf/'))
|
let dir = s:FILE.unify_path(expand(g:spacevim_data_dir
|
||||||
if !isdirectory(dir)
|
\ . 'SpaceVim/conf/'))
|
||||||
call mkdir(dir, 'p')
|
if !isdirectory(dir)
|
||||||
endif
|
call mkdir(dir, 'p')
|
||||||
call SpaceVim#logger#info('generate local conf: ' . local_conf_cache)
|
endif
|
||||||
call writefile([s:JSON.json_encode(conf)], local_conf_cache)
|
call SpaceVim#logger#info('generate local conf: ' . local_conf_cache)
|
||||||
call s:apply(conf, 'local')
|
call writefile([s:JSON.json_encode(conf)], local_conf_cache)
|
||||||
|
call s:apply(conf, 'local')
|
||||||
|
catch
|
||||||
|
call SpaceVim#logger#warn('failed to load local config:' . v:errmsg, 0)
|
||||||
|
endtry
|
||||||
endif
|
endif
|
||||||
elseif filereadable('.SpaceVim.d/init.vim')
|
elseif filereadable('.SpaceVim.d/init.vim')
|
||||||
let local_dir = s:FILE.unify_path(
|
let local_dir = s:FILE.unify_path(
|
||||||
@ -351,9 +355,13 @@ function! s:load_glob_conf() abort
|
|||||||
if !isdirectory(dir)
|
if !isdirectory(dir)
|
||||||
call mkdir(dir, 'p')
|
call mkdir(dir, 'p')
|
||||||
endif
|
endif
|
||||||
let conf = s:TOML.parse_file(global_config)
|
try
|
||||||
call writefile([s:JSON.json_encode(conf)], global_config_cache)
|
let conf = s:TOML.parse_file(global_config)
|
||||||
call s:apply(conf, 'glob')
|
call writefile([s:JSON.json_encode(conf)], global_config_cache)
|
||||||
|
call s:apply(conf, 'glob')
|
||||||
|
catch
|
||||||
|
call SpaceVim#logger#warn('failed to load global config:' . v:errmsg, 0)
|
||||||
|
endtry
|
||||||
endif
|
endif
|
||||||
elseif filereadable(global_dir . 'init.vim')
|
elseif filereadable(global_dir . 'init.vim')
|
||||||
let g:_spacevim_global_config_path = global_dir . 'init.vim'
|
let g:_spacevim_global_config_path = global_dir . 'init.vim'
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
if exists('g:GuiLoaded')
|
if exists('g:GuiLoaded')
|
||||||
if exists('g:spacevim_guifont') && !empty(g:spacevim_guifont)
|
if exists('g:spacevim_guifont') && !empty(g:spacevim_guifont)
|
||||||
exe 'Guifont! ' . g:spacevim_guifont
|
exe 'Guifont! ' . g:spacevim_guifont
|
||||||
else
|
|
||||||
exe 'Guifont! SauceCodePro Nerd Font Mono:h11:cANSI:qDRAFT'
|
|
||||||
endif
|
endif
|
||||||
" As using neovim-qt by default
|
" As using neovim-qt by default
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user