NeoBundle uses runtime directory

* Initial version included here as submodule
* Use version from g:vim_vardata/bundles otherwise
* This avoids polluting the configuration directory with bundles
This commit is contained in:
Emmanuel BENOîT 2015-02-22 17:25:10 +01:00
parent bd749b79d0
commit 49b97afd6a
7 changed files with 38 additions and 29 deletions

2
.gitignore vendored
View file

@ -1,3 +1 @@
/bundle
/.netrwhist /.netrwhist
/keys

7
.gitmodules vendored
View file

@ -1,6 +1,3 @@
[submodule "bundle/neobundle.vim"] [submodule "neobundle-initial"]
path = bundle/neobundle.vim path = neobundle-initial
url = https://github.com/Shougo/neobundle.vim.git url = https://github.com/Shougo/neobundle.vim.git
[submodule "bundle/vimproc.vim"]
path = bundle/vimproc.vim
url = https://github.com/Shougo/vimproc.vim.git

@ -1 +0,0 @@
Subproject commit 04b45cd80f48f66daed04a1a48a7ea4e7d316086

View file

@ -0,0 +1,9 @@
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }

View file

@ -1,34 +1,48 @@
" Load and initialise NeoBundle and plugins " Load and initialise NeoBundle and plugins
let s:bundles_dir = g:vim_home . "/bundle/" if !exists( "g:bundles_dir" )
let g:bundles_dir = g:vim_vardata . "/bundles/"
elseif g:bundles_dir !~ "/$"
let g:bundles_dir = g:bundles_dir . "/"
endif
if !CreateDirectoryIfNecessary( g:bundles_dir )
unlet g:bundles_dir
finish
endif
if has( 'vim_starting' ) if has( 'vim_starting' )
if &compatible if &compatible
set nocompatible set nocompatible
endif endif
let s:neobundle_path=s:bundles_dir . "neobundle.vim/" if isdirectory( g:bundles_dir . "neobundle.vim" )
let s:neobundle_path = g:bundles_dir . "neobundle.vim"
else
let s:neobundle_path = g:vim_home . "/neobundle-initial"
endif
let &g:runtimepath = &g:runtimepath . "," . s:neobundle_path let &g:runtimepath = &g:runtimepath . "," . s:neobundle_path
endif endif
call neobundle#begin( s:bundles_dir ) call neobundle#begin( g:bundles_dir )
" Load NeoBundle itself, as well as VimProc " Load NeoBundle itself, as well as VimProc
NeoBundleFetch 'Shougo/neobundle.vim' NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
" Load all plugins from bundles-init/*.load " Load all plugins from bundles-init/*.load
let s:binit_dir = g:vim_home . "/bundles-init" let s:binit_dir = g:vim_home . "/bundles-init"
for s:plfn in glob( s:binit_dir . "/*.load.vim" , 0 , 1 ) for s:plfn in glob( s:binit_dir . "/*.load.vim" , 0 , 1 )
execute "source" s:plfn execute "source" s:plfn
" Create configuration loading hooks
let s:pname = fnamemodify( s:plfn , ":t:r:r" )
let s:bundle = neobundle#get( s:pname )
function! s:bundle.hooks.on_post_source( bundle )
let cfgfile = s:binit_dir . "/" . a:bundle.name . ".cfg.vim"
if filereadable( l:cfgfile )
execute "source" l:cfgfile
endif
endfunction
endfor endfor
call neobundle#end() call neobundle#end()

View file

@ -16,17 +16,9 @@ NeoBundleCheck
" Call hooks on reload " Call hooks on reload
if !has( "vim_starting" ) if !has( "vim_starting" )
call neobundle#call_hook( "on_source" ) call neobundle#call_hook( "on_source" )
call neobundle#call_hook( "on_post_source" )
endif endif
" Load configuration files for all installed plugins
let s:binit_dir = g:vim_home . "/bundles-init"
for s:pcfn in glob( s:binit_dir . "/*.cfg.vim" , 0 , 1 )
let s:pname = fnamemodify( s:pcfn , ":t:r:r" )
if neobundle#is_installed( s:pname )
execute "source" s:pcfn
endif
endfor
" Restore filetype settings " Restore filetype settings
if ! s:has_fti if ! s:has_fti
filetype indent off filetype indent off