2023-06-17 17:13:40 +02:00
|
|
|
" Load and initialise Dein and plugins
|
2015-02-22 10:37:39 +01:00
|
|
|
|
2015-02-22 17:25:10 +01:00
|
|
|
if !exists( "g:bundles_dir" )
|
2015-02-23 08:33:14 +01:00
|
|
|
if exists( "g:vim_local['local_bundles']" )
|
|
|
|
if !exists( "g:vim_local['vardata']" )
|
|
|
|
echo "Local bundles requested, but local data directory is not set."
|
|
|
|
endif
|
|
|
|
let g:bundles_dir = GetVardataPath( "bundles" )
|
|
|
|
else
|
|
|
|
let g:bundles_dir = g:vim_vardata . "/bundles/"
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if g:bundles_dir !~ "/$"
|
2015-02-22 17:25:10 +01:00
|
|
|
let g:bundles_dir = g:bundles_dir . "/"
|
|
|
|
endif
|
|
|
|
if !CreateDirectoryIfNecessary( g:bundles_dir )
|
|
|
|
unlet g:bundles_dir
|
2023-06-17 17:13:40 +02:00
|
|
|
function! CheckDeinInstall()
|
2015-02-23 22:11:15 +01:00
|
|
|
" Empty placeholder function
|
|
|
|
endfunction
|
2015-02-22 17:25:10 +01:00
|
|
|
finish
|
|
|
|
endif
|
2015-02-22 10:37:39 +01:00
|
|
|
|
|
|
|
if has( 'vim_starting' )
|
|
|
|
if &compatible
|
|
|
|
set nocompatible
|
|
|
|
endif
|
|
|
|
|
2023-06-17 17:13:40 +02:00
|
|
|
let s:dein_path = g:bundles_dir . "github.com/Shougo/dein.vim"
|
|
|
|
if !isdirectory(s:dein_path)
|
|
|
|
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_path
|
2015-02-22 17:25:10 +01:00
|
|
|
else
|
2023-06-17 17:13:40 +02:00
|
|
|
echo "Wat " . s:dein_path
|
2015-02-22 17:25:10 +01:00
|
|
|
endif
|
2023-06-17 17:13:40 +02:00
|
|
|
let &g:runtimepath = &g:runtimepath . "," . s:dein_path
|
2015-02-22 10:37:39 +01:00
|
|
|
endif
|
|
|
|
|
2023-06-17 17:13:40 +02:00
|
|
|
call dein#begin( g:bundles_dir )
|
2015-02-22 10:37:39 +01:00
|
|
|
|
2023-06-17 17:13:40 +02:00
|
|
|
" Load Dein itself
|
|
|
|
call dein#add(s:dein_path)
|
2015-02-22 16:18:12 +01:00
|
|
|
|
2015-02-23 11:15:27 +01:00
|
|
|
" Load all plugins from bundles-init/*.load.vim
|
2023-06-17 17:13:40 +02:00
|
|
|
let s:binit_dir = g:vim_home . "/plugins"
|
|
|
|
let s:bundle_load_files = GetConfigFiles( "plugins" , "*.load.vim" )
|
2015-02-23 18:19:12 +01:00
|
|
|
for s:plfn in values( s:bundle_load_files )
|
2015-02-22 16:18:12 +01:00
|
|
|
execute "source" s:plfn
|
2015-02-22 17:25:10 +01:00
|
|
|
|
|
|
|
" Create configuration loading hooks
|
|
|
|
let s:pname = fnamemodify( s:plfn , ":t:r:r" )
|
2023-06-17 17:13:40 +02:00
|
|
|
let s:bundle = dein#get( s:pname )
|
2015-02-23 18:19:12 +01:00
|
|
|
if empty( s:bundle )
|
|
|
|
continue
|
|
|
|
endif
|
2015-02-22 17:25:10 +01:00
|
|
|
|
|
|
|
function! s:bundle.hooks.on_post_source( bundle )
|
2023-06-17 17:13:40 +02:00
|
|
|
let cfgfile = GetConfigFilePath( "plugins" ,
|
2015-02-23 11:15:27 +01:00
|
|
|
\ a:bundle.name . ".cfg.vim" )
|
|
|
|
if l:cfgfile != ""
|
2015-02-22 17:25:10 +01:00
|
|
|
execute "source" l:cfgfile
|
|
|
|
endif
|
|
|
|
endfunction
|
2015-02-22 16:18:12 +01:00
|
|
|
endfor
|
2015-02-22 10:37:39 +01:00
|
|
|
|
2023-06-17 17:13:40 +02:00
|
|
|
call dein#end()
|
2015-02-23 22:11:15 +01:00
|
|
|
|
2023-06-17 17:13:40 +02:00
|
|
|
function! CheckDeinInstall()
|
|
|
|
" Let Dein check for installations
|
|
|
|
if dein#check_install()
|
|
|
|
call dein#install()
|
|
|
|
endif
|
|
|
|
call dein#call_hook( "on_post_source" )
|
2015-02-23 22:11:15 +01:00
|
|
|
endfunction
|