To open files in Grep's output to Vim's -o -mode

前端 未结 6 980
死守一世寂寞
死守一世寂寞 2021-01-31 14:19

How can you put a list of files to Vim\'s -o -mode?

I have a list of files as Grep\'s output. I run unsuccessfully

1

grep -il          


        
6条回答
  •  有刺的猬
    2021-01-31 14:56

    To invoke vim using xargs, xargs must be invoked with -o:

    grep -il sid * | xargs -o vim -o
    

    In case filenames could contain spaces, use grep -Z with xargs -0

    grep -ilZ sid * | xargs -0 -o vim -o
    

    Without xargs -o, we would get a warning:

    Vim: Warning: Input is not from a terminal
    

    The -o option exists on OSX/BSD. Also, the -o option is found in GNU findutils built from git. This option was added after 4.6.0.

提交回复
热议问题