diff --git a/config-bits/00-vardata.vim b/cfg-pre/00-vardata.vim similarity index 100% rename from config-bits/00-vardata.vim rename to cfg-pre/00-vardata.vim diff --git a/config-bits/01-signatures.vim b/cfg-pre/10-signatures.vim similarity index 100% rename from config-bits/01-signatures.vim rename to cfg-pre/10-signatures.vim diff --git a/config-bits/03-filetype-syntax.vim b/cfg-pre/15-enable-filetype.vim similarity index 100% rename from config-bits/03-filetype-syntax.vim rename to cfg-pre/15-enable-filetype.vim diff --git a/config-bits/09-local-config.vim b/cfg-pre/50-local-config.vim similarity index 100% rename from config-bits/09-local-config.vim rename to cfg-pre/50-local-config.vim diff --git a/config-bits/10-neobundle.vim b/cfg-pre/75-neobundle.vim similarity index 65% rename from config-bits/10-neobundle.vim rename to cfg-pre/75-neobundle.vim index fc150b4..1905df5 100644 --- a/config-bits/10-neobundle.vim +++ b/cfg-pre/75-neobundle.vim @@ -1,4 +1,5 @@ " Load and initialise NeoBundle and plugins +echo "location" if !exists( "g:bundles_dir" ) if exists( "g:vim_local['local_bundles']" ) @@ -16,6 +17,9 @@ if g:bundles_dir !~ "/$" endif if !CreateDirectoryIfNecessary( g:bundles_dir ) unlet g:bundles_dir + function! DoNeoBundleCheck() + " Empty placeholder function + endfunction finish endif @@ -60,3 +64,36 @@ for s:plfn in values( s:bundle_load_files ) endfor call neobundle#end() + +" Function that runs NeoBundleCheck after enabling all filetype bits; it +" restores them on exit +function! DoNeoBundleCheck() + " Save current filetype settings + let s:has_ft = exists( "g:did_load_filetypes" ) + let s:has_fti = exists( "g:did_indent_on" ) + let s:has_ftp = exists( "g:did_load_ftplugin" ) + + " Enable filetype with both indent and plugins + if !( s:has_ft && s:has_fti && s:has_ftp ) + filetype plugin indent on + endif + + " Let NeoBundle check for installations + NeoBundleCheck + + " Call hooks on reload + if !has( "vim_starting" ) + call neobundle#call_hook( "on_post_source" ) + endif + + " Restore filetype settings + if ! s:has_fti + filetype indent off + endif + if ! s:has_ftp + filetype plugin off + endif + if ! s:has_ft + filetype off + endif +endfunction diff --git a/cfg-pre/99-run-main-config.vim b/cfg-pre/99-run-main-config.vim new file mode 100644 index 0000000..e1d90c2 --- /dev/null +++ b/cfg-pre/99-run-main-config.vim @@ -0,0 +1,7 @@ +" Loads the main configuration from cfg/, using a merge from the main and +" local configurations. + +let s:cfg_files = GetConfigFiles( "cfg" , "??-?*.vim" ) +for s:cfg_file in sort( keys( s:cfg_files ) ) + execute 'source ' . s:cfg_files[ s:cfg_file ] +endfor diff --git a/config-bits/02-colours.vim b/cfg/01-colours.vim similarity index 100% rename from config-bits/02-colours.vim rename to cfg/01-colours.vim diff --git a/config-bits/04-edit-options.vim b/cfg/02-edit-options.vim similarity index 100% rename from config-bits/04-edit-options.vim rename to cfg/02-edit-options.vim diff --git a/config-bits/02-ui-options.vim b/cfg/02-ui-options.vim similarity index 100% rename from config-bits/02-ui-options.vim rename to cfg/02-ui-options.vim diff --git a/config-bits/02-wildignore.vim b/cfg/03-wildignore.vim similarity index 100% rename from config-bits/02-wildignore.vim rename to cfg/03-wildignore.vim diff --git a/cfg/20-install-bundles.vim b/cfg/20-install-bundles.vim new file mode 100644 index 0000000..ad7c418 --- /dev/null +++ b/cfg/20-install-bundles.vim @@ -0,0 +1,7 @@ +" Force NeoBundle to check the loaded plugins and install them + +call DoNeoBundleCheck( ) + +" Do mappings somewhere else +" nmap :NeoBundleCheckUpdate +" nmap :call DoNeoBundleCheck() diff --git a/config-bits/50-install-bundles.vim b/config-bits/50-install-bundles.vim deleted file mode 100644 index 835e117..0000000 --- a/config-bits/50-install-bundles.vim +++ /dev/null @@ -1,38 +0,0 @@ -" Force NeoBundle to check the loaded plugins and install them - -function! DoNeoBundleCheck() - " Save current filetype settings - let s:has_ft = exists( "g:did_load_filetypes" ) - let s:has_fti = exists( "g:did_indent_on" ) - let s:has_ftp = exists( "g:did_load_ftplugin" ) - - " Enable filetype with both indent and plugins - if !( s:has_ft && s:has_fti && s:has_ftp ) - filetype plugin indent on - endif - - " Let NeoBundle check for installations - NeoBundleCheck - - " Call hooks on reload - if !has( "vim_starting" ) - call neobundle#call_hook( "on_post_source" ) - endif - - " Restore filetype settings - if ! s:has_fti - filetype indent off - endif - if ! s:has_ftp - filetype plugin off - endif - if ! s:has_ft - filetype off - endif -endfunction - -call DoNeoBundleCheck( ) - -" Do mappings somewhere else -" nmap :NeoBundleCheckUpdate -" nmap :call DoNeoBundleCheck() diff --git a/vimrc b/vimrc index eb48287..fb60e31 100644 --- a/vimrc +++ b/vimrc @@ -24,8 +24,9 @@ else finish endif -" Execute configuration in config-bits -let s:cfg_bits_path = g:vim_home . '/config-bits' +" Execute configuration in cfg-pre/, which should in turn execute the main +" configuration in cfg/ +let s:cfg_bits_path = g:vim_home . '/cfg-pre' let s:cfg_files = glob( s:cfg_bits_path . '/??-?*.vim' ) for s:cfg_file in sort( split( s:cfg_files , "\n" ) ) execute 'source ' . s:cfg_file