mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 22:59:15 +08:00
Add cmdline menu
This commit is contained in:
parent
2a0165429f
commit
70c465086e
@ -371,6 +371,13 @@ function! SpaceVim#loadCustomConfig() abort
|
||||
let custom_confs = SpaceVim#util#globpath(getcwd(), '.SpaceVim.d/init.vim')
|
||||
let custom_glob_conf_old = expand('~/.local.vim')
|
||||
let custom_glob_conf = expand('~/.SpaceVim.d/init.vim')
|
||||
if !filereadable(custom_glob_conf_old) && !filereadable(custom_glob_conf)
|
||||
" if there is no custom config auto generate it.
|
||||
augroup SpaceVimBootstrap
|
||||
au!
|
||||
au VimEnter * call timer_start(10, function('SpaceVim#custom#autoconfig'))
|
||||
augroup END
|
||||
endif
|
||||
" the old value will be remove
|
||||
if filereadable(custom_glob_conf_old)
|
||||
exe 'source ' . custom_glob_conf_old
|
||||
|
@ -20,3 +20,33 @@ endfunction
|
||||
" What distribution of spacemacs would you like to start with?
|
||||
" The standard distribution, recommended (spacemacs)
|
||||
" A minimalist distribution that you can build on (spacemacs-base)
|
||||
|
||||
function! SpaceVim#custom#autoconfig(...) abort
|
||||
let menu = SpaceVim#api#import('cmdlinemenu')
|
||||
let ques = [
|
||||
\ ['dark powered mode', function('s:awesome_mode')],
|
||||
\ ['basic mode', function('s:basic_mode')],
|
||||
\ ]
|
||||
call menu.menu(ques)
|
||||
endfunction
|
||||
|
||||
function! s:awesome_mode() abort
|
||||
let config = []
|
||||
call s:write_to_config(config)
|
||||
endfunction
|
||||
|
||||
function! s:basic_mode() abort
|
||||
let config = []
|
||||
call s:write_to_config(config)
|
||||
endfunction
|
||||
|
||||
function! s:write_to_config(config) abort
|
||||
let cf = expand('~/.SpaceVim.d/init.vim')
|
||||
if filereadable(cf)
|
||||
return
|
||||
endif
|
||||
if !isdirectory(fnamemodify(cf, ':p:h'))
|
||||
call mkdir(expand(fnamemodify(cf, ':p:h')), 'p')
|
||||
endif
|
||||
call writefile(a:config, cf, '')
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user