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

I am reading a large base of C ++ code in Vim.

In one file I can do

/foo n n n 

Now, if I want to search across multiple files, I have to do:

 :vimgrep /foo/ :cn :cn :cn 

Now, typing :cn is much less convenient than n . Is there a way to search for vimgrep results using n (e.g. search with / ) instead of :cn ?

+4
source share
2 answers

Use the Quickfix List . It will be automatically filled with matches found (whether you use :grep or :vimgrep ). It can be moved using regular keys (so the key is for "next" j instead of n ).

To open it, use :copen .

+6
source

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

 nmap <F7> :cp^M nmap <F8> :cn^M 
+4
source

Source: https://habr.com/ru/post/1300497/


All Articles