mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 10:50:07 +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');
|
ga('send', 'pageview');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var _hmt = _hmt || [];
|
var _hmt = _hmt || [];
|
||||||
(function() {
|
(function() {
|
||||||
@ -21,6 +20,7 @@ s.parentNode.insertBefore(hm, s);
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
### SpaceVim
|
### SpaceVim
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/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)
|
![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)
|
[![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
|
#### 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:
|
here is an example:
|
||||||
|
|
||||||
|
@ -120,6 +120,13 @@ let g:spacevim_disabled_plugins = []
|
|||||||
" <
|
" <
|
||||||
let g:spacevim_custom_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.
|
" enable/disable SpaceVim with powerline symbols.
|
||||||
let g:spacevim_enable_powerline_fonts = 1
|
let g:spacevim_enable_powerline_fonts = 1
|
||||||
""
|
""
|
||||||
@ -144,21 +151,35 @@ let g:spacevim_wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,
|
|||||||
\.git,.svn,.hg,.DS_Store'
|
\.git,.svn,.hg,.DS_Store'
|
||||||
|
|
||||||
function! SpaceVim#loadCustomConfig() abort
|
function! SpaceVim#loadCustomConfig() abort
|
||||||
let custom_confs = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
let custom_confs_old = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||||
let custom_glob_conf = expand('~/.local.vim')
|
let custom_confs = SpaceVim#util#globpath(getcwd(), '.SpaceVim.d/init.vim')
|
||||||
if filereadable(custom_glob_conf)
|
let custom_glob_conf_old = expand('~/.local.vim')
|
||||||
exe 'source ' . custom_glob_conf
|
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
|
endif
|
||||||
if isdirectory(expand('~/.SpaceVim.d/'))
|
if !empty(custom_confs_old)
|
||||||
set runtimepath^=~/.SpaceVim.d
|
exe 'source ' . custom_confs_old[0]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(custom_confs)
|
if !empty(custom_confs)
|
||||||
exe 'source ' . custom_confs[0]
|
exe 'source ' . custom_confs[0]
|
||||||
endif
|
|
||||||
if isdirectory('.SpaceVim.d')
|
if isdirectory('.SpaceVim.d')
|
||||||
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
exe 'set rtp ^=' . expand('.SpaceVim.d')
|
||||||
endif
|
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
|
endfunction
|
||||||
|
|
||||||
""
|
""
|
||||||
|
@ -233,10 +233,13 @@ let s:plugins.ctrlp = [
|
|||||||
if !has('nvim')
|
if !has('nvim')
|
||||||
call add(s:plugins.ctrlp, ['wsdjeg/ctrlp-unity3d-docs', { 'on_cmd' : 'CtrlPUnity3DDocs'}])
|
call add(s:plugins.ctrlp, ['wsdjeg/ctrlp-unity3d-docs', { 'on_cmd' : 'CtrlPUnity3DDocs'}])
|
||||||
endif
|
endif
|
||||||
function! SpaceVim#plugins#get(...) abort
|
let s:plugins.github = [
|
||||||
|
\ ['junegunn/vim-github-dashboard', { 'on_cmd':['GHD','GHA','GHActivity','GHDashboard']}],
|
||||||
endfunction
|
\ ]
|
||||||
|
let s:plugins.vim = [
|
||||||
|
\ ['Shougo/vimshell.vim', { 'on_cmd':['VimShell']}],
|
||||||
|
\ ['mattn/vim-terminal', { 'on_cmd':['Terminal']}],
|
||||||
|
\ ]
|
||||||
function! SpaceVim#plugins#load() abort
|
function! SpaceVim#plugins#load() abort
|
||||||
if zvim#plug#enable_plug()
|
if zvim#plug#enable_plug()
|
||||||
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
|
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
|
||||||
@ -244,14 +247,6 @@ function! SpaceVim#plugins#load() abort
|
|||||||
call s:load_plugins()
|
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-scriptease')
|
||||||
call zvim#plug#add('tpope/vim-fugitive')
|
call zvim#plug#add('tpope/vim-fugitive')
|
||||||
call zvim#plug#add('cohama/agit.vim', { 'on_cmd':['Agit','AgitFile']})
|
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'})
|
call zvim#plug#add('scrooloose/nerdtree',{'on_cmd':'NERDTreeToggle'})
|
||||||
if zvim#plug#tap('nerdtree')
|
if zvim#plug#tap('nerdtree')
|
||||||
call zvim#plug#defind_hooks('nerdtree')
|
call zvim#plug#defind_hooks('nerdtree')
|
||||||
function! OpenOrCloseNERDTree()
|
function! OpenOrCloseNERDTree() abort
|
||||||
exec 'normal! A'
|
exec 'normal! A'
|
||||||
endfunction
|
endfunction
|
||||||
noremap <silent> <F9> :NERDTreeToggle<CR>
|
noremap <silent> <F9> :NERDTreeToggle<CR>
|
||||||
@ -443,3 +438,7 @@ function! s:disable_plugins(plugin_list) abort
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
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*
|
*g:spacevim_enable_powerline_fonts*
|
||||||
enable/disable SpaceVim with powerline symbols.
|
enable/disable SpaceVim with powerline symbols.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user