From ec8b56e7ae1c16d90b8925134e396a7807c48e76 Mon Sep 17 00:00:00 2001 From: gmarik Date: Mon, 8 Aug 2011 23:01:52 -0500 Subject: [PATCH] BundleClean uses new UI as well - TODO: refactor: extract common code --- autoload/vundle.vim | 1 + autoload/vundle/installer.vim | 42 +++++++++++++++++++++++++++++++---- autoload/vundle/scripts.vim | 3 +++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 863d1f3..68be06d 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -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 diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 22f5357..b92c9ea 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -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') - let cmd = (has('win32') || has('win64')) ? - \ 'rmdir /S /Q' : - \ 'rm -rf' - exec '!'.cmd.' '.join(map(x_dirs, 'shellescape(v:val)'), ' ') + + 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' + + 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 diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 06c6d3e..7b8ead2 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -29,10 +29,13 @@ func! vundle#scripts#setup_view() abort syn keyword vimCommand Bundle + com! -buffer -bang -nargs=1 DeleteBundle call vundle#installer#delete('!' == '', ) com! -buffer -bang -nargs=? InstallBundle call vundle#installer#install('!' == '', ) com! -buffer -nargs=0 VundleLog call s:view_log() nnoremap q :silent bd! + nnoremap d :exec 'Delete'.getline('.') + nnoremap i :exec 'Install'.getline('.') nnoremap I :exec 'Install'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')