mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 20:30:05 +08:00
Improve custom config loadding
This commit is contained in:
parent
5a0ad933cd
commit
7f79e9eadd
@ -9,7 +9,6 @@ ga('create', 'UA-89745542-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
@ -21,6 +20,7 @@ s.parentNode.insertBefore(hm, s);
|
||||
</script>
|
||||
</head>
|
||||
### SpaceVim
|
||||
|
||||
[![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim)
|
||||
![Version 0.1.0-dev](https://img.shields.io/badge/version-0.1.0--dev-yellow.svg?style=flat-square)
|
||||
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
|
||||
@ -110,7 +110,9 @@ git clone https://github.com/SpaceVim/SpaceVim.git AppData\Local\nvim
|
||||
|
||||
#### Modular configuration
|
||||
|
||||
SpaceVim will load custom configuration from `~/.local.vim` and `.local.vim` in current directory.
|
||||
- SpaceVim will load custom configuration from `~/.local.vim` and `.local.vim` in current directory.
|
||||
- SpaceVim support `~/.SpaceVim.d/init.vim` and `./SpaceVim.d/init.vim`.
|
||||
|
||||
|
||||
here is an example:
|
||||
|
||||
|
@ -120,6 +120,13 @@ let g:spacevim_disabled_plugins = []
|
||||
" <
|
||||
let g:spacevim_custom_plugins = []
|
||||
""
|
||||
" SpaceVim will load global config after local config if set to 1. by default
|
||||
" it is 0, if you has local config, the global config will not be loaded.
|
||||
" >
|
||||
" let g:spacevim_force_global_config = 1
|
||||
" <
|
||||
let g:spacevim_force_global_config = 0
|
||||
""
|
||||
" enable/disable SpaceVim with powerline symbols.
|
||||
let g:spacevim_enable_powerline_fonts = 1
|
||||
""
|
||||
@ -144,20 +151,34 @@ let g:spacevim_wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,
|
||||
\.git,.svn,.hg,.DS_Store'
|
||||
|
||||
function! SpaceVim#loadCustomConfig() abort
|
||||
let custom_confs = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||
let custom_glob_conf = expand('~/.local.vim')
|
||||
if filereadable(custom_glob_conf)
|
||||
exe 'source ' . custom_glob_conf
|
||||
let custom_confs_old = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||
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')
|
||||
" the old value will be remove
|
||||
if filereadable(custom_glob_conf_old)
|
||||
exe 'source ' . custom_glob_conf_old
|
||||
endif
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
if !empty(custom_confs_old)
|
||||
exe 'source ' . custom_confs_old[0]
|
||||
endif
|
||||
|
||||
if !empty(custom_confs)
|
||||
exe 'source ' . custom_confs[0]
|
||||
endif
|
||||
if isdirectory('.SpaceVim.d')
|
||||
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
||||
if isdirectory('.SpaceVim.d')
|
||||
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
||||
endif
|
||||
if filereadable(custom_glob_conf) && g:spacevim_force_global_config
|
||||
exe 'source ' . custom_glob_conf
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
endif
|
||||
elseif filereadable(custom_glob_conf)
|
||||
exe 'source ' . custom_glob_conf
|
||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
||||
set runtimepath^=~/.SpaceVim.d
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -233,10 +233,13 @@ let s:plugins.ctrlp = [
|
||||
if !has('nvim')
|
||||
call add(s:plugins.ctrlp, ['wsdjeg/ctrlp-unity3d-docs', { 'on_cmd' : 'CtrlPUnity3DDocs'}])
|
||||
endif
|
||||
function! SpaceVim#plugins#get(...) abort
|
||||
|
||||
endfunction
|
||||
|
||||
let s:plugins.github = [
|
||||
\ ['junegunn/vim-github-dashboard', { 'on_cmd':['GHD','GHA','GHActivity','GHDashboard']}],
|
||||
\ ]
|
||||
let s:plugins.vim = [
|
||||
\ ['Shougo/vimshell.vim', { 'on_cmd':['VimShell']}],
|
||||
\ ['mattn/vim-terminal', { 'on_cmd':['Terminal']}],
|
||||
\ ]
|
||||
function! SpaceVim#plugins#load() abort
|
||||
if zvim#plug#enable_plug()
|
||||
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
|
||||
@ -244,14 +247,6 @@ function! SpaceVim#plugins#load() abort
|
||||
call s:load_plugins()
|
||||
|
||||
|
||||
if count(g:spacevim_plugin_groups, 'github') "{{{
|
||||
call zvim#plug#add('junegunn/vim-github-dashboard', { 'on_cmd':['GHD','GHA','GHActivity','GHDashboard']})
|
||||
endif
|
||||
|
||||
if count(g:spacevim_plugin_groups, 'vim') "{{{
|
||||
call zvim#plug#add('Shougo/vimshell.vim', { 'on_cmd':['VimShell']})
|
||||
call zvim#plug#add('mattn/vim-terminal', { 'on_cmd':['Terminal']})
|
||||
endif
|
||||
call zvim#plug#add('tpope/vim-scriptease')
|
||||
call zvim#plug#add('tpope/vim-fugitive')
|
||||
call zvim#plug#add('cohama/agit.vim', { 'on_cmd':['Agit','AgitFile']})
|
||||
@ -337,7 +332,7 @@ function! SpaceVim#plugins#load() abort
|
||||
call zvim#plug#add('scrooloose/nerdtree',{'on_cmd':'NERDTreeToggle'})
|
||||
if zvim#plug#tap('nerdtree')
|
||||
call zvim#plug#defind_hooks('nerdtree')
|
||||
function! OpenOrCloseNERDTree()
|
||||
function! OpenOrCloseNERDTree() abort
|
||||
exec 'normal! A'
|
||||
endfunction
|
||||
noremap <silent> <F9> :NERDTreeToggle<CR>
|
||||
@ -443,3 +438,7 @@ function! s:disable_plugins(plugin_list) abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#get(...) abort
|
||||
|
||||
endfunction
|
||||
|
||||
|
@ -117,6 +117,13 @@ Add custom plugins
|
||||
\ ]
|
||||
<
|
||||
|
||||
*g:spacevim_force_global_config*
|
||||
SpaceVim will load global config after local config if set to 1. by default it
|
||||
is 0, if you has local config, the global config will not be loaded.
|
||||
>
|
||||
let g:spacevim_force_global_config = 1
|
||||
<
|
||||
|
||||
*g:spacevim_enable_powerline_fonts*
|
||||
enable/disable SpaceVim with powerline symbols.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user