开发者

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

开发者 https://www.devze.com 2022-12-19 14:44 出处:网络
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:

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

精彩评论

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

关注公众号