How do I yank all matching lines into one buffer?

后端 未结 3 1170
情话喂你
情话喂你 2021-01-30 06:26

How do you yank all matching lines into a buffer?

Given a file like:

match 1
skip
skip
match 2
match 3
skip

I want to be able issue a c

3条回答
  •  终归单人心
    2021-01-30 07:18

    Oh I just realized after commenting above that it's easy to yank matching lines into a temporary buffer...

    :r !grep "pattern" file.txt

    The simplest solutions come once you've given up on finding them. :)

提交回复
热议问题