开发者

Is there a shorter key combination than :cn to go to the next item in the quickfix list?

I'm reading through a large C++ code base in Vim.

Within a single file, I can do

/foo
n
n
n

Now, if I want to search through more than one file, I have to do:

:vimgrep /foo/
:cn
:cn
:cn

Now, typing :cn is so much less convenient than n. Is there a way to search t开发者_高级运维hrough vimgrep results with n (like searches with /) instead of :cn?


Use the Quickfix List. It will automatically be filled with found matches (no matter if you use :grep or :vimgrep). It can be navigated with the usual keys (so the key for "next" is j instead of n).

To open it use :copen.


This is what I have in my .vimrc exactly for this purpose:

nmap <F7> :cp^M
nmap <F8> :cn^M
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜