On 5/31/06, Cory Echols <[EMAIL PROTECTED]> wrote:
On 5/31/06, Bernhard Leiner <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm looking for a good soultion to to search for a keyword in all open
buffers.
>
> Using the :bufdo command to search in all buffers basically does what
> I want but the output isn't very useable. Using :vimgrep on multiple
> _files_ with its output in the quickfix window is much better but
> works only on files.
>
> Sombody has an idea?
Like most vim commands, if you use '%' as the file name argument to a
vimgrep command, it will expand to the filename of the current buffer.
This means you can use:
:bufdo vimgrepadd /pattern/ %
The catch is that 'vimgrepadd' *adds* matches to the current match
list. If there's already entries in it, they'll be added to instead
of replaced. I couldn't find any command that would clear the current
:cex ''
works.
quickfix list, so I suppose you'd have to search for an unmatchable
pattern to clear it. Try 200 x's anchored at the beginning of a line
in the current buffer. Another catch is that I couldn't get :vimgrep
to accept a '|' command separator, so you have to do them in two
steps.
:vimgrep /\v^x{200}/ %
:bufdo vimgrepadd /pattern/ %
I guess you'll have to make a function instead of using "|" for
commands like this.