VIM search for pattern into quickfix

前端 未结 2 1390
情书的邮戳
情书的邮戳 2021-02-04 13:51

Basically I need to create a quickfix buffer listing all lines that match a regex. What is the best way?

The global command may not be the best, but I think it should

相关标签:
2条回答
  • 2021-02-04 14:02

    You can also not use the global command and stick with what is built-in. Use the vimgrep command as below:

    :vimgrep /pattern/ %
    

    And then :copen or :cwindow

    0 讨论(0)
  • 2021-02-04 14:19

    Use caddexpr:-

    g/<pattern>/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")
    
    0 讨论(0)
提交回复
热议问题