When using grep from VIM, how to jump to results?

Posted by Marplesoft on Super User See other posts from Super User or by Marplesoft
Published on 2011-02-22T04:55:58Z Indexed on 2011/02/22 7:27 UTC
Read the original article Hit count: 557

Filed under:
|
|

When using the grep plugin to VIM, I can search the current directory for all occurrences of a string within a set of files, like this:

:grep Ryan *.txt

This outputs something like this:

file1.txt:3:Ryan was here
file2.txt:10:Ryan likes VIM
file3.txt:5:superuser.com is a fav of Ryan
(1 of 3): Ryan was here
Press ENTER or type command to continue

If I press enter, it just takes me back to my editor. What I really want to do is be able to open up one of those files and jump to the place where the string was found. Is there a way to do this? The 1 of 3 part makes me think there's a way to tab through the results, but I don't know what commands are available to me. Can anybody shed some light on this?

© Super User or respective owner

Related posts about linux

Related posts about command-line