When using grep from VIM, how to jump to results?
When you press ENTER, you should be looking at line 3 of file1.txt. To jump to the next match, execute :cn
; to jump to the previous match, execute :cp
. Executing :copen
will open a window containing the list of matches. Move the cursor to the desired match and press ENTER to jump to that match.
For more on using :grep
, see
:help grep
:help quickfix.txt
Typing :cn
and :cp
to move forward and backward in the quickfix list can be awkward, so I use these mappings:
nmap <silent> <C-N> :cn<CR>zv
nmap <silent> <C-P> :cp<CR>zv
Also, the :grep
command is not a plugin; it's part of Vim.