Re-organised configuration files
This commit is contained in:
parent
2d7eff306a
commit
34f84c9155
13 changed files with 54 additions and 40 deletions
|
@ -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
|
7
cfg-pre/99-run-main-config.vim
Normal file
7
cfg-pre/99-run-main-config.vim
Normal file
|
@ -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
|
7
cfg/20-install-bundles.vim
Normal file
7
cfg/20-install-bundles.vim
Normal file
|
@ -0,0 +1,7 @@
|
|||
" Force NeoBundle to check the loaded plugins and install them
|
||||
|
||||
call DoNeoBundleCheck( )
|
||||
|
||||
" Do mappings somewhere else
|
||||
" nmap <silent> <S-F12> :NeoBundleCheckUpdate<cr>
|
||||
" nmap <silent> <C-F12> :call DoNeoBundleCheck()<cr>
|
|
@ -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 <silent> <S-F12> :NeoBundleCheckUpdate<cr>
|
||||
" nmap <silent> <C-F12> :call DoNeoBundleCheck()<cr>
|
5
vimrc
5
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
|
||||
|
|
Loading…
Reference in a new issue