From 56329965482b9bce5004ce48e5cdf2cf97ba1096 Mon Sep 17 00:00:00 2001 From: gmarik Date: Fri, 26 Nov 2010 16:14:17 -0600 Subject: [PATCH] Reuse same window for sarch results --- autoload/vundle/scripts.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f20eca4..4d28710 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -1,9 +1,16 @@ 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 + call s:display(results, a:search_str) +endf + +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 setlocal hls ft=vim redraw