BundleClean uses new UI as well

- TODO: refactor: extract common code
This commit is contained in:
gmarik 2011-08-08 23:01:52 -05:00
parent e8c962156c
commit ec8b56e7ae
3 changed files with 42 additions and 4 deletions

View File

@ -34,6 +34,7 @@ sign define Vu_error text=! texthl=Error
sign define Vu_active text=> texthl=Comment
sign define Vu_todate text=. texthl=Comment
sign define Vu_updated text=+ texthl=Comment
sign define Vu_deleted text=- texthl=Comment
endif

View File

@ -89,10 +89,44 @@ func! vundle#installer#clean(bang) abort
redraw!
if (a:bang || input('Are you sure you want to remove '.len(x_dirs).' bundles? [ y/n ]:') =~? 'y')
for l in range(1,len(x_dirs))
redraw!
exec ':norm d'
sleep 1m
" goto next one
exec ':+1'
endfor
redraw!
echo 'Done!'
endif
endf
func! vundle#installer#delete(bang, dir_name) abort
let cmd = (has('win32') || has('win64')) ?
\ 'rmdir /S /Q' :
\ 'rm -rf'
exec '!'.cmd.' '.join(map(x_dirs, 'shellescape(v:val)'), ' ')
let path = shellescape(expand(g:bundle_dir.'/'.a:dir_name))
let cmd .= ' '.path
let out = s:system(cmd)
call s:log('')
call s:log('Bundle '.a:dir_name)
call s:log('$ '.cmd)
call s:log('> '.out)
if 0 != v:shell_error
call s:sign('error')
return 'error'
else
call s:sign('deleted')
return 'deleted'
endif
endf

View File

@ -29,10 +29,13 @@ func! vundle#scripts#setup_view() abort
syn keyword vimCommand Bundle
com! -buffer -bang -nargs=1 DeleteBundle call vundle#installer#delete('!' == '<bang>', <args>)
com! -buffer -bang -nargs=? InstallBundle call vundle#installer#install('!' == '<bang>', <q-args>)
com! -buffer -nargs=0 VundleLog call s:view_log()
nnoremap <buffer> q :silent bd!<CR>
nnoremap <buffer> d :exec 'Delete'.getline('.')<CR>
nnoremap <buffer> i :exec 'Install'.getline('.')<CR>
nnoremap <buffer> I :exec 'Install'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')<CR>