On Fri 8-Dec-06 10:18am -0600, Ben K. 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>" )

-- 
Best regards,
Bill

Reply via email to