From b85b45b80f00cfbc058db02b5a28e2480a0f2926 Mon Sep 17 00:00:00 2001 From: gmarik Date: Sat, 19 Mar 2011 13:12:31 -0500 Subject: [PATCH] introduce :Bundles - unify search and browse unders same interface --- autoload/vundle.vim | 9 +++++---- autoload/vundle/scripts.vim | 18 +++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 5e4c08e..759a2ca 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -16,11 +16,12 @@ com! -nargs=? -bang BundleClean com! -nargs=0 BundleDocs \ call vundle#installer#helptags(g:bundles) -com! -nargs=+ -bang BundleSearch - \ silent call vundle#scripts#search('!' == '', ) +com! -nargs=? -bang Bundles + \ call vundle#scripts#all('!'=='', ) -com! -nargs=0 Vundle - \ call vundle#scripts#browse() +" deprecated in favor of Bundles +com! -nargs=? -bang BundleSearch + \ call vundle#scripts#all('!' == '', ) com! -nargs=0 VundleLog \ silent pedit `=g:vundle_log` diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index c3c808f..8b77bae 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -1,12 +1,12 @@ -func! vundle#scripts#search(bang,search_str) - let matches = filter(s:load_scripts(a:bang), 'v:val =~? "'.escape(a:search_str,'"').'"') - call s:display(['" Search results for: '.a:search_str], matches) - let @/=a:search_str - redraw -endf - -func! vundle#scripts#browse() - call s:display(['" Vim scripts: '], s:load_scripts(0)) +func! vundle#scripts#all(bang, ...) + if a:1== '' " whether refine search string given + call s:display(['" Vim scripts: '], s:load_scripts(a:bang)) + else + let matches = filter(s:load_scripts(a:bang), 'v:val =~? "'.escape(a:1,'"').'"') + call s:display(['" Search results for: '.a:1], matches) + let @/=a:1 + redraw + endif endf func! vundle#scripts#complete(a,c,d)