From 014eaec120799b97ae381061f9872db7423531e5 Mon Sep 17 00:00:00 2001 From: gmarik Date: Fri, 26 Nov 2010 12:33:17 -0600 Subject: [PATCH] BundleSearch! will refresh scripts before search - stay updated --- autoload/vundle.vim | 8 ++++---- autoload/vundle/scripts.vim | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 3578406..8e97113 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -3,11 +3,11 @@ " Version: 0.2 " Readme: http://github.com/gmarik/vundle/blob/master/README.md -com! -nargs=+ Bundle call vundle#add_bundle() -com! -nargs=0 BundleInstall call vundle#install_bundles() -com! -nargs=0 BundleDocs call vundle#helptagify_bundles() +com! -nargs=+ Bundle call vundle#add_bundle() +com! -nargs=0 BundleInstall call vundle#install_bundles() +com! -nargs=0 BundleDocs call vundle#helptagify_bundles() -com! -nargs=* BundleSearch silent call vundle#scripts#search() +com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("", ) func! vundle#rc() let g:bundle_dir = expand('$HOME/.vim/bundle/') diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index c32880a..f20eca4 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -1,10 +1,10 @@ -func! vundle#scripts#search(...) - let matches = filter(eval(vundle#scripts#read()), 'v:val =~ "'.escape(a:1,'"').'"') +func! vundle#scripts#search(bang,search_str) + let matches = filter(eval(vundle#scripts#read(a:bang)), 'v:val =~ "'.escape(a:search_str,'"').'"') let results = map(matches, ' printf("Bundle \"%s\"", v:val) ') let temp = tempname() call writefile(results, temp) exec 'sp '.temp - let @/=a:1 + let @/=a:search_str setlocal hls ft=vim redraw endf @@ -15,9 +15,9 @@ func! vundle#scripts#fetch(to) exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to endf -func! vundle#scripts#read() +func! vundle#scripts#read(bang) let scripts_file = expand('$HOME/.vim-vundle/vim-scripts.org.json') - if !filereadable(scripts_file) + if '!' == a:bang || !filereadable(scripts_file) call vundle#scripts#fetch(scripts_file) endif return readfile(scripts_file, 'b')[0]