vimgrep是vim自带的一个工具,类似于grep的用法就可以实现。比如要在当前目录查找word,使用如下:
如果想要递归查找所有下级目录里面,那么就用
另外,如果想要在使用是快捷查找当前光标下的字母,则只需要在vimrc中添加如下代码:
通过vimgrep查找到的结果会生成到quickfix中,如下图:
There are a lot of commands for quickfix as you have said, but I tend to find I only use a small subset of them:
:copen " Open the quickfix window
:ccl " Close it
:cw " Open it if there are "errors", close it otherwise (some people prefer this)
:cn " Go to the next error in the window
:cnf " Go to the first error in the next file
get back to the
Quickfix List
I type
Ctrl
+
W
You can also use
:cc 2
(or any other number) to jump to, in this case, the second error in the quickfix window. Navigating with :cn
, :cc 4
, etc will put the cursor on the line in question.