1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-04 02:30:04 +08:00
SpaceVim/autoload/SpaceVim/plugins.vim
Wang Shidong e55d6cf270
Improve core config (#1455)
* Improve core config

* Fixup

* Update mode

* Remove plugin groups

* Enable denite layer if has +py3

* Update dev scripts

* Add project patten pom.xml for java layer

* Add tools layer
2018-03-03 21:52:08 +08:00

76 lines
2.0 KiB
VimL

"=============================================================================
" plugins.vim --- plugin wrapper
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
scriptencoding utf-8
function! SpaceVim#plugins#load() abort
if zvim#plug#enable_plug()
call zvim#plug#begin(g:spacevim_plugin_bundle_dir)
call zvim#plug#fetch()
call s:load_plugins()
call s:disable_plugins(g:spacevim_disabled_plugins)
call zvim#plug#end()
endif
endfunction
function! s:load_plugins() abort
for group in SpaceVim#layers#get()
let g:_spacevim_plugin_layer = group
for plugin in s:getLayerPlugins(group)
if len(plugin) == 2
call zvim#plug#add(plugin[0], plugin[1])
if zvim#plug#tap(split(plugin[0], '/')[-1]) && get(plugin[1], 'loadconf', 0 )
call zvim#plug#defind_hooks(split(plugin[0], '/')[-1])
endif
if zvim#plug#tap(split(plugin[0], '/')[-1]) && get(plugin[1], 'loadconf_before', 0 )
call zvim#plug#loadPluginBefore(split(plugin[0], '/')[-1])
endif
else
call zvim#plug#add(plugin[0])
endif
endfor
call s:loadLayerConfig(group)
endfor
unlet g:_spacevim_plugin_layer
for plugin in g:spacevim_custom_plugins
if len(plugin) == 2
call zvim#plug#add(plugin[0], plugin[1])
else
call zvim#plug#add(plugin[0])
endif
endfor
endfunction
function! s:getLayerPlugins(layer) abort
let p = []
try
let p = SpaceVim#layers#{a:layer}#plugins()
catch /^Vim\%((\a\+)\)\=:E117/
endtry
return p
endfunction
function! s:loadLayerConfig(layer) abort
try
call SpaceVim#layers#{a:layer}#config()
catch /^Vim\%((\a\+)\)\=:E117/
endtry
endfunction
function! s:disable_plugins(plugin_list) abort
for name in a:plugin_list
call dein#disable(name)
endfor
endfunction
function! SpaceVim#plugins#get(...) abort
endfunction
" vim:set et sw=2: