On Fri, 8 Dec 2006, Bill McCarthy wrote:
Is there a way to do grep only within the open files (buffers)?
I did :he grep and bufdo but it didn't seem to give me the option.
Here's one I have in my vimrc:
" Do a :vim on all listed buffers. To find "fopen":
" :Bufvim /fopen/
function! s:bufvim( arg )
let a = ""
let i = 1
while i <= bufnr("$")
if buflisted(i) && bufname(i) != ""
let a = a . ' ' . escape(bufname(i), ' \')
endif
let i = i + 1
endwhile
exe "vim " . a:arg . a
endfunction
com! -nargs=1 Bufvim call <SID>bufvim( "<args>" )
Thanks.
Regards,
Ben K.
Developer
http://benix.tamu.edu