BundleSearch! will refresh scripts before search

- stay updated
This commit is contained in:
gmarik 2010-11-26 12:33:17 -06:00
parent 7f7b3f1097
commit 014eaec120
2 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ com! -nargs=+ Bundle call vundle#add_bundle(<args>)
com! -nargs=0 BundleInstall call vundle#install_bundles() com! -nargs=0 BundleInstall call vundle#install_bundles()
com! -nargs=0 BundleDocs call vundle#helptagify_bundles() com! -nargs=0 BundleDocs call vundle#helptagify_bundles()
com! -nargs=* BundleSearch silent call vundle#scripts#search(<q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>)
func! vundle#rc() func! vundle#rc()
let g:bundle_dir = expand('$HOME/.vim/bundle/') let g:bundle_dir = expand('$HOME/.vim/bundle/')

View File

@ -1,10 +1,10 @@
func! vundle#scripts#search(...) func! vundle#scripts#search(bang,search_str)
let matches = filter(eval(vundle#scripts#read()), 'v:val =~ "'.escape(a:1,'"').'"') 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 results = map(matches, ' printf("Bundle \"%s\"", v:val) ')
let temp = tempname() let temp = tempname()
call writefile(results, temp) call writefile(results, temp)
exec 'sp '.temp exec 'sp '.temp
let @/=a:1 let @/=a:search_str
setlocal hls ft=vim setlocal hls ft=vim
redraw redraw
endf endf
@ -15,9 +15,9 @@ func! vundle#scripts#fetch(to)
exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to
endf endf
func! vundle#scripts#read() func! vundle#scripts#read(bang)
let scripts_file = expand('$HOME/.vim-vundle/vim-scripts.org.json') 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) call vundle#scripts#fetch(scripts_file)
endif endif
return readfile(scripts_file, 'b')[0] return readfile(scripts_file, 'b')[0]