diff --git a/.gitignore b/.gitignore index 66d6d5e..a5c1fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/bundle /.netrwhist -/keys diff --git a/.gitmodules b/.gitmodules index 5587fe6..36a4ced 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "bundle/neobundle.vim"] - path = bundle/neobundle.vim +[submodule "neobundle-initial"] + path = neobundle-initial url = https://github.com/Shougo/neobundle.vim.git -[submodule "bundle/vimproc.vim"] - path = bundle/vimproc.vim - url = https://github.com/Shougo/vimproc.vim.git diff --git a/bundle/vimproc.vim b/bundle/vimproc.vim deleted file mode 160000 index 04b45cd..0000000 --- a/bundle/vimproc.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 04b45cd80f48f66daed04a1a48a7ea4e7d316086 diff --git a/bundles-init/vimproc.vim.load.vim b/bundles-init/vimproc.vim.load.vim new file mode 100644 index 0000000..3f94d13 --- /dev/null +++ b/bundles-init/vimproc.vim.load.vim @@ -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', + \ }, + \ } diff --git a/config-bits/20-neobundle.vim b/config-bits/20-neobundle.vim index 1ecf396..8ad46ca 100644 --- a/config-bits/20-neobundle.vim +++ b/config-bits/20-neobundle.vim @@ -1,34 +1,48 @@ " 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 &compatible set nocompatible 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 endif -call neobundle#begin( s:bundles_dir ) +call neobundle#begin( g:bundles_dir ) " Load NeoBundle itself, as well as VimProc 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 let s:binit_dir = g:vim_home . "/bundles-init" for s:plfn in glob( s:binit_dir . "/*.load.vim" , 0 , 1 ) 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 call neobundle#end() diff --git a/config-bits/50-install-bundles.vim b/config-bits/50-install-bundles.vim index 9a895bf..676335c 100644 --- a/config-bits/50-install-bundles.vim +++ b/config-bits/50-install-bundles.vim @@ -16,17 +16,9 @@ NeoBundleCheck " Call hooks on reload if !has( "vim_starting" ) call neobundle#call_hook( "on_source" ) + call neobundle#call_hook( "on_post_source" ) 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 if ! s:has_fti filetype indent off diff --git a/bundle/neobundle.vim b/neobundle-initial similarity index 100% rename from bundle/neobundle.vim rename to neobundle-initial