BundleClean cleans up unused scripts

- removes unused directories
This commit is contained in:
gmarik 2011-01-20 14:59:49 -06:00
parent 55a5ef041c
commit 75f14de912
3 changed files with 17 additions and 2 deletions

View File

@ -9,6 +9,7 @@
- install configured scripts (aka bundle) - install configured scripts (aka bundle)
- manage runtime path of your installed scripts so you don't have to - manage runtime path of your installed scripts so you don't have to
- search [all available vim scripts] by name - search [all available vim scripts] by name
- clean up from unused scripts
[Vundle] takes advantage of [vim-scripts.org](http://vim-scripts.org) [Vundle] takes advantage of [vim-scripts.org](http://vim-scripts.org)
in order to install/search [all available vim scripts] in order to install/search [all available vim scripts]
@ -50,7 +51,7 @@ in order to install/search [all available vim scripts]
:BundleSearch foo :BundleSearch foo
will split new window with results: lists search results in new split window, ie:
Bundle "VimFootnotes" Bundle "VimFootnotes"
Bundle "foo.vim" Bundle "foo.vim"
@ -59,10 +60,16 @@ so you can just copy ones you need to <code>.vimrc</code>.
:BundleSearch! foo :BundleSearch! foo
will refresh scripts list before doing search. refreshes script list before performing actual search.
Searching requires [<code>curl</code>](http://curl.haxx.se/) Searching requires [<code>curl</code>](http://curl.haxx.se/)
## Cleaning up
:BundleClean
removes unused script dirs from your `.vim/bundle`
## Examples ## Examples
See [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136) for working example. See [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136) for working example.

View File

@ -6,6 +6,7 @@
com! -nargs=+ Bundle call vundle#config#bundle(<args>) com! -nargs=+ Bundle call vundle#config#bundle(<args>)
com! -nargs=? -bang BundleInstall call vundle#installer#install("<bang>") com! -nargs=? -bang BundleInstall call vundle#installer#install("<bang>")
com! -nargs=? BundleClean call vundle#installer#clean()
com! -nargs=0 BundleDocs call vundle#installer#helptags() com! -nargs=0 BundleDocs call vundle#installer#helptags()
com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>)

View File

@ -42,6 +42,13 @@ func! s:install(bang, bundle)
if synced | call vundle#config#require(a:bundle) | endif if synced | call vundle#config#require(a:bundle) | endif
endf endf
func! vundle#installer#clean()
let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let all_dirs = split(globpath(g:bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')
for d in x_dirs | exec '!rm -rf "'.escape(d,'"').'"' | endfor
endf
" TODO: make it pause after output in console mode " TODO: make it pause after output in console mode
func! s:log(msg) func! s:log(msg)
if has('gui_running') if has('gui_running')