Use Dein for plugin management instead of NeoVim

This commit is contained in:
Emmanuel BENOîT 2023-06-17 17:13:40 +02:00
parent 8a2762a269
commit ca8d12fc83
No known key found for this signature in database
GPG key ID: 2356DC6956CF54EF

View file

@ -1,4 +1,4 @@
" Load and initialise NeoBundle and plugins " Load and initialise Dein and plugins
if !exists( "g:bundles_dir" ) if !exists( "g:bundles_dir" )
if exists( "g:vim_local['local_bundles']" ) if exists( "g:vim_local['local_bundles']" )
@ -16,7 +16,7 @@ if g:bundles_dir !~ "/$"
endif endif
if !CreateDirectoryIfNecessary( g:bundles_dir ) if !CreateDirectoryIfNecessary( g:bundles_dir )
unlet g:bundles_dir unlet g:bundles_dir
function! DoNeoBundleCheck() function! CheckDeinInstall()
" Empty placeholder function " Empty placeholder function
endfunction endfunction
finish finish
@ -27,34 +27,35 @@ if has( 'vim_starting' )
set nocompatible set nocompatible
endif endif
if isdirectory( g:bundles_dir . "neobundle.vim" ) let s:dein_path = g:bundles_dir . "github.com/Shougo/dein.vim"
let s:neobundle_path = g:bundles_dir . "neobundle.vim" if !isdirectory(s:dein_path)
execute '!git clone https://github.com/Shougo/dein.vim' s:dein_path
else else
let s:neobundle_path = g:vim_home . "/neobundle-initial" echo "Wat " . s:dein_path
endif endif
let &g:runtimepath = &g:runtimepath . "," . s:neobundle_path let &g:runtimepath = &g:runtimepath . "," . s:dein_path
endif endif
call neobundle#begin( g:bundles_dir ) call dein#begin( g:bundles_dir )
" Load NeoBundle itself, as well as VimProc " Load Dein itself
NeoBundleFetch 'Shougo/neobundle.vim' call dein#add(s:dein_path)
" Load all plugins from bundles-init/*.load.vim " Load all plugins from bundles-init/*.load.vim
let s:binit_dir = g:vim_home . "/bundles-init" let s:binit_dir = g:vim_home . "/plugins"
let s:bundle_load_files = GetConfigFiles( "bundles-init" , "*.load.vim" ) let s:bundle_load_files = GetConfigFiles( "plugins" , "*.load.vim" )
for s:plfn in values( s:bundle_load_files ) for s:plfn in values( s:bundle_load_files )
execute "source" s:plfn execute "source" s:plfn
" Create configuration loading hooks " Create configuration loading hooks
let s:pname = fnamemodify( s:plfn , ":t:r:r" ) let s:pname = fnamemodify( s:plfn , ":t:r:r" )
let s:bundle = neobundle#get( s:pname ) let s:bundle = dein#get( s:pname )
if empty( s:bundle ) if empty( s:bundle )
continue continue
endif endif
function! s:bundle.hooks.on_post_source( bundle ) function! s:bundle.hooks.on_post_source( bundle )
let cfgfile = GetConfigFilePath( "bundles-init" , let cfgfile = GetConfigFilePath( "plugins" ,
\ a:bundle.name . ".cfg.vim" ) \ a:bundle.name . ".cfg.vim" )
if l:cfgfile != "" if l:cfgfile != ""
execute "source" l:cfgfile execute "source" l:cfgfile
@ -62,10 +63,12 @@ for s:plfn in values( s:bundle_load_files )
endfunction endfunction
endfor endfor
call neobundle#end() call dein#end()
function! DoNeoBundleCheck() function! CheckDeinInstall()
" Let NeoBundle check for installations " Let Dein check for installations
NeoBundleCheck if dein#check_install()
call neobundle#call_hook( "on_post_source" ) call dein#install()
endif
call dein#call_hook( "on_post_source" )
endfunction endfunction