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

前端 未结 8 1419
无人共我
无人共我 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:17

    I think this is what you are looking for:

    http://www.vim.org/scripts/script.php?script_id=2184

    When you open a file:line, for instance when coping and pasting from an error from your compiler (or grep output) vim tries to open a file with a colon in its name. With this little script in your plugins folder if the stuff after the colon is a number and a file exists with the name especified before the colon vim will open this file and take you to the line you wished in the first place.

    It's definitely what I was looking for.

提交回复
热议问题