On Tue 26-Sep-06 8:46am -0600, KLEIN Stéphane wrote:

> How can I do a "grep" on all vim buffer ?

The following, not fully tested, uses vimgrep on all loaded
and named buffers:

----------------------------------------------------------
function! s:bufvim( arg )
    let a = ""
    let i = 1
    while i <= bufnr("$")
        if bufloaded(i)
            if "bufname(i)" != ""
                let a = a . ' ' . escape(bufname(i), ' \')
            endif
        endif
        let i = i + 1
    endwhile
    exe "vim " . a:arg . a
endfunction

com! -nargs=1 Bufvim call <SID>bufvim( "<args>" )
----------------------------------------------------------

To search for the word "return" in all buffers:

    :Bufvim /\<return\>/

-- 
Best regards,
Bill

Reply via email to