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

@ -3,11 +3,11 @@
" Version: 0.2
" Readme: http://github.com/gmarik/vundle/blob/master/README.md
com! -nargs=+ Bundle call vundle#add_bundle(<args>)
com! -nargs=0 BundleInstall call vundle#install_bundles()
com! -nargs=0 BundleDocs call vundle#helptagify_bundles()
com! -nargs=+ Bundle call vundle#add_bundle(<args>)
com! -nargs=0 BundleInstall call vundle#install_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()
let g:bundle_dir = expand('$HOME/.vim/bundle/')

View File

@ -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]