diff --git a/autoload/vundle.vim b/autoload/vundle.vim index a59c943..baaeb8a 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -7,7 +7,7 @@ com! -nargs=+ Bundle \ call vundle#config#bundle() -com! -nargs=+ BundleLoad +com! -nargs=+ -complete=custom,vundle#scripts#unloaded BundleLoad \ call vundle#installer#load() com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall @@ -22,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 9e71007..f846cc6 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -12,16 +12,28 @@ func! vundle#installer#new(bang, ...) abort endf func! vundle#installer#load(...) - echom join(a:000,'') + " 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,'') + " 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 = '' @@ -133,18 +145,26 @@ 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 ? 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 324c281..2af95e9 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()