Reuse same window for sarch results

This commit is contained in:
gmarik 2010-11-26 16:14:17 -06:00
parent 8f1ed0eb6c
commit 5632996548

View File

@ -1,9 +1,16 @@
func! vundle#scripts#search(bang,search_str) func! vundle#scripts#search(bang,search_str)
let matches = filter(eval(vundle#scripts#read(a:bang)), 'v:val =~ "'.escape(a: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 results = map(matches, ' printf("Bundle \"%s\"", v:val) ')
let temp = tempname() call s:display(results, a:search_str)
call writefile(results, temp) endf
exec 'sp '.temp
func! s:display(results,search_str)
if !exists('s:buff')
let s:buff = tempname()
split
endif
call writefile(['" Search results for: '.a:search_str] + a:results, s:buff)
exec 'e '.s:buff
let @/=a:search_str let @/=a:search_str
setlocal hls ft=vim setlocal hls ft=vim
redraw redraw