On 2007-03-07, "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote:
> Gary Johnson wrote:
> > If I open a new window, read into it the results of a grep command,
> > e.g.,
> >
> > :r !grep -nH somepattern somefileset
> >
> > and then try to use that buffer as a quickfix list or location list
> > with either the :cb or :lb commands, respectively, I get
> >
> > E37: No write since last change (add ! to override)
> >
> > If I then try to add ! to the :cb or :lb commands, I get
> >
> > E477: No ! allowed
> >
> > It seems to me that the :cb and :lb commands are missing the ability
> > to handle a !.
> >
> > The most recent version of vim I had to verify this with was
> > 7.0.178.
> >
> > Regards,
> > Gary
> >
>
> If what you want to do with the output of grep is use it as a quickfix
> error list, then use ":grep" or ":lgrep" instead of ":r !grep". Or you can
> also use ":vimgrep" or ":lvimgrep" for internal grep (with Vim-style
> regexps).
>
> See ":help grep".
I use :grep all the time. I've also started using :lgrep to go off
on "side searches" so that I can return to the main quickfix list
without having to remember how many times to execute :cold.
In the present case, I wanted to build a quickfix/location list with
a very specific set of targets, so the best way seemed to be to
create the whole list of targets in a buffer, then edit that list
before committing it to the quickfix/location list. I just learned
about the :cb command recently from a post in some mailing list
(probably vim, but I can't find it now). This was my first attempt
at using it, and it worked beautifully except for the error message.
It seems pretty clear that there has been an oversight in the
implementation of the :cb and :lb commands, even pointed to by the
text of E37. If there is some reason that the :cb and :lb commands
should not be extended to accept !, then the current text of E37 is
inappropriate for that error condition.
Regards,
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Mobile Broadband Division
| Spokane, Washington, USA