On Wed, May 27, 2009 at 4:09 PM, Ben Fritz <[email protected]> wrote:

>
>
>
> On May 27, 1:18 pm, Chris Mueller <[email protected]> wrote:
> > Hola.
> >
> > Currently, I use...
> >
> > "View last search results in their own window (Cur file)
> >
> > nmap <leader>w :vimgrep //j %<CR>:copen<CR><CR>
> >
> > to open up a quickfix window of my last searched term in my quickfix
> > window.  I usually have a number of buffers open; is it possible to do
> the
> > same behavior, but in all open buffers?  (I'd like to map to <leader>W).
>  It
> > seems at least once a day I want to do this; but I have not come up with
> an
> > easy method yet.
>
> As a starting point, consider this series of commands:
>
> let g:buflist = ""
> bufdo let g:buflist.=" ".expand("%:p")
> execute "vimgrep //j ".g:buflist
> copen
>
> I assume you know how to find help on these commands. You can chain
> them together in your mapping using \| or <Bar>. Tweak as desired.
>
> Note, from your description, you may actually want :tabdo and/
> or :windo instead of :bufdo, but I took your meaning literally.
> --~--~---------~--~----~------------~-------~--~----~


Thanks for the nudge, works perfectly:)  I use session files to keep track
of relevant files for projects; and thus load all relevant files into
buffers on editor start; so this works well for my current work flow.

Thanks,
   Chris


nmap <leader>W :call BufSearch() <cr>

function! BufSearch()
    echo @/
    let g:buflist = ""
    bufdo let g:buflist.=" ".expand("%:p")
    execute "vimgrep /".@/."/j ".g:buflist
    copen
endfunction

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to