1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-04 05:00:03 +08:00
SpaceVim/autoload/SpaceVim/plugins.vim

76 lines
2.0 KiB
VimL
Raw Normal View History

"=============================================================================
" plugins.vim --- plugin wrapper
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
2017-01-08 18:38:45 +08:00
scriptencoding utf-8
2017-01-07 16:49:21 +08:00
function! SpaceVim#plugins#load() abort
2017-03-06 23:26:26 +08:00
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
2017-01-07 19:49:29 +08:00
endfunction
function! s:load_plugins() abort
for group in SpaceVim#layers#get()
let g:_spacevim_plugin_layer = group
2017-03-06 23:26:26 +08:00
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])
2017-04-03 12:30:08 +08:00
endif
if zvim#plug#tap(split(plugin[0], '/')[-1]) && get(plugin[1], 'loadconf_before', 0 )
call zvim#plug#loadPluginBefore(split(plugin[0], '/')[-1])
2017-01-09 22:50:06 +08:00
endif
2017-03-06 23:26:26 +08:00
else
call zvim#plug#add(plugin[0])
endif
2017-01-09 22:50:06 +08:00
endfor
2017-03-06 23:26:26 +08:00
call s:loadLayerConfig(group)
endfor
unlet g:_spacevim_plugin_layer
2017-03-06 23:26:26 +08:00
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
2017-01-07 19:49:29 +08:00
endfunction
2017-01-13 00:35:46 +08:00
function! s:getLayerPlugins(layer) abort
2017-03-06 23:26:26 +08:00
let p = []
try
let p = SpaceVim#layers#{a:layer}#plugins()
catch /^Vim\%((\a\+)\)\=:E117/
endtry
return p
2017-01-13 00:35:46 +08:00
endfunction
2017-01-14 21:17:24 +08:00
function! s:loadLayerConfig(layer) abort
2017-03-06 23:26:26 +08:00
try
call SpaceVim#layers#{a:layer}#config()
catch /^Vim\%((\a\+)\)\=:E117/
endtry
2017-01-14 21:17:24 +08:00
endfunction
2017-01-07 19:49:29 +08:00
function! s:disable_plugins(plugin_list) abort
2017-03-06 23:26:26 +08:00
for name in a:plugin_list
call dein#disable(name)
endfor
2017-01-07 16:49:21 +08:00
endfunction
2017-01-07 19:49:29 +08:00
2017-01-10 00:27:52 +08:00
function! SpaceVim#plugins#get(...) abort
endfunction
2017-03-06 23:26:26 +08:00
" vim:set et sw=2: