On 2019-05-24 04:40, DwigtArmyOfChampions wrote:
> From a bash shell I can type "grep -l 'foo' *" and that will output
> a list of files that contain 'foo'. I want to vim that list of
> files. In other words, assuming the grep command returns file1,
> file2, ... filen, I want to run the command:
>
> vim file1 file2 file3 ... filen
As others have mentioned, you have
vim $(grep -l 'foo' *)
and
grep -l foo * | xargs vim
(which then has vim complain that input isn't from stdin)
Moreover, vim has some built-in grepping functionality which might be
helpful:
:vimgrep foo *
then you can use
:cn
:cN
:crew
to navigate them, as well as (at least as of a somewhat recent
version of vim) the
:cdo
:cfdo
commands which let you perform operations across all the matches or
across all the matching files. Especially since :vimgrep supports all
the power of Vim's regular expressions which can do things that
grep(1) can't do.
-tim