Browse Source

setup BundleLoad and BundleClean autocomplete, allow one-off cleaning

pull/133/head
Rich Alesi 14 years ago
parent
commit
4458bb4c8d
3 changed files with 33 additions and 9 deletions
  1. +3
    -3
      autoload/vundle.vim
  2. +26
    -6
      autoload/vundle/installer.vim
  3. +4
    -0
      autoload/vundle/scripts.vim

+ 3
- 3
autoload/vundle.vim View File

@ -7,7 +7,7 @@
com! -nargs=+ Bundle com! -nargs=+ Bundle
\ call vundle#config#bundle(<args>) \ call vundle#config#bundle(<args>)
com! -nargs=+ BundleLoad
com! -nargs=+ -complete=custom,vundle#scripts#unloaded BundleLoad
\ call vundle#installer#load(<args>) \ call vundle#installer#load(<args>)
com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall 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 com! -nargs=0 -bang BundleList
\ call vundle#installer#list('!'=='<bang>') \ call vundle#installer#list('!'=='<bang>')
com! -nargs=? -bang BundleClean
\ call vundle#installer#clean('!' == '<bang>')
com! -nargs=? -bang -complete=custom,vundle#scripts#unloaded BundleClean
\ call vundle#installer#clean('!' == '<bang>', <args>)
com! -nargs=0 BundleDocs com! -nargs=0 BundleDocs
\ call vundle#installer#helptags(g:bundles) \ call vundle#installer#helptags(g:bundles)


+ 26
- 6
autoload/vundle/installer.vim View File

@ -12,16 +12,28 @@ func! vundle#installer#new(bang, ...) abort
endf endf
func! vundle#installer#load(...) func! vundle#installer#load(...)
echom join(a:000,'')
" echom join(a:000,'')
let bundles = (a:0 == '') ? let bundles = (a:0 == '') ?
\ g:bundles : \ g:bundles :
\ map(copy(a:000), 'vundle#config#bundle(v:val, {})') \ map(copy(a:000), 'vundle#config#bundle(v:val, {})')
call vundle#config#require(bundles) 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 " apply newly loaded ftbundles to currently open buffers
echom join(bundles,'')
" echom join(bundles,'')
doautoall BufRead doautoall BufRead
endf 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) func! s:process(bang, cmd)
let msg = '' let msg = ''
@ -133,18 +145,26 @@ func! vundle#installer#list(bang) abort
echo len(g:bundles).' bundles configured' echo len(g:bundles).' bundles configured'
endf endf
func! vundle#installer#clean(bang) abort
func! vundle#installer#unloaded() abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()') 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 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)') 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 headers = ['" All clean!']
let names = [] let names = []
elseif a:name =~ join(unloaded,'\|')
let headers = ['" Removing bundle:']
let names = vundle#scripts#bundle_names([a:name])
else else
let headers = ['" Removing bundles:'] 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 end
call vundle#scripts#view('clean', headers, names) call vundle#scripts#view('clean', headers, names)


+ 4
- 0
autoload/vundle/scripts.vim View File

@ -22,6 +22,10 @@ func! vundle#scripts#complete(a,c,d)
return join(s:load_scripts(0),"\n") return join(s:load_scripts(0),"\n")
endf endf
func! vundle#scripts#unloaded(a,c,d)
return join(map(vundle#installer#unloaded(), ' printf("'."'%s'".'", v:val) '),"\n")
endf
func! s:view_log() func! s:view_log()
if !exists('g:vundle_log_file') if !exists('g:vundle_log_file')
let g:vundle_log_file = tempname() let g:vundle_log_file = tempname()


Loading…
Cancel
Save