Vim: open files of the matches on the lines given by Grep?

前端 未结 8 1310
无人共我
无人共我 2021-02-02 16:46

I want to get automatically to the positions of the results in Vim after grepping, on command line. Is there such feature?

Files to open in Vim on the lines give

8条回答
  •  隐瞒了意图╮
    2021-02-02 17:31

    If you use git, results are often more meaningful when you search only in the files tracked by git. To open files at the given line which is a search result of git grep in vim you will need the fugitive plugin, then

    :copen
    :Ggrep pattern
    

    Will give you the list in a buffer and you can choose to open files from your git grep results.

提交回复
热议问题