diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 0bc7bf5..f688f56 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -7,6 +7,9 @@ com! -nargs=+ Bundle \ call vundle#config#bundle() +com! -nargs=+ -complete=custom,vundle#scripts#unloaded BundleLoad +\ call vundle#installer#load() + com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall \ call vundle#installer#new('!' == '', ) @@ -19,8 +22,8 @@ com! -nargs=? -bang -complete=custom,vundle#scripts#complete Bundles com! -nargs=0 -bang BundleList \ call vundle#installer#list('!'=='') -com! -nargs=? -bang BundleClean -\ call vundle#installer#clean('!' == '') +com! -nargs=? -bang -complete=custom,vundle#scripts#unloaded BundleClean +\ call vundle#installer#clean('!' == '', ) com! -nargs=0 BundleDocs \ call vundle#installer#helptags(g:bundles) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 55dbeff..ab1c353 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -11,6 +11,28 @@ func! vundle#installer#new(bang, ...) abort call vundle#config#require(bundles) endf +func! vundle#installer#load(...) + " echom join(a:000,'') + let bundles = (a:0 == '') ? + \ g:bundles : + \ map(copy(a:000), 'vundle#config#bundle(v:val, {})') + call vundle#config#require(bundles) + + " check for parameter function + for v in bundles + :call s:settings(v.name) + endfor + " apply newly loaded ftbundles to currently open buffers + " echom join(bundles,'') + doautoall BufRead +endf + +func! s:settings(name) + exec "echom 'Param_".a:name."'" + if exists("*Params_".a:name) + exec "call Param_".a:name + endif +endfunc func! s:process(bang, cmd) let msg = '' @@ -142,20 +164,28 @@ func! vundle#installer#list(bang) abort echo len(g:bundles).' bundles configured' endf - -func! vundle#installer#clean(bang) abort +func! vundle#installer#unloaded() abort let bundle_dirs = map(copy(g:bundles), 'v:val.path()') let all_dirs = (v:version > 702 || (v:version == 702 && has("patch51"))) \ ? split(globpath(g:bundle_dir, '*', 1), "\n") \ : split(globpath(g:bundle_dir, '*'), "\n") let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') + return map(copy(x_dirs), 'fnamemodify(v:val, ":t")') +endfunc + +func! vundle#installer#clean(bang, name) abort + + let unloaded = vundle#installer#unloaded() - if empty(x_dirs) + if empty(unloaded) let headers = ['" All clean!'] let names = [] + elseif a:name =~ join(unloaded,'\|') + let headers = ['" Removing bundle:'] + let names = vundle#scripts#bundle_names([a:name]) else let headers = ['" Removing bundles:'] - let names = vundle#scripts#bundle_names(map(copy(x_dirs), 'fnamemodify(v:val, ":t")')) + let names = vundle#scripts#bundle_names(unloaded) end call vundle#scripts#view('clean', headers, names) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index d8989ed..a69c325 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -22,6 +22,10 @@ func! vundle#scripts#complete(a,c,d) return join(s:load_scripts(0),"\n") endf +func! vundle#scripts#unloaded(a,c,d) + return join(map(vundle#installer#unloaded(), ' printf("'."'%s'".'", v:val) '),"\n") +endf + func! s:view_log() if !exists('g:vundle_log_file') let g:vundle_log_file = tempname()