I\'m having several occurrences of a specific string over several files in several lines obtained with grep
.
$ grep -rn --include=\"*.cpp\" mystring
Here is another way to do
$ grep -rn --include="*.cpp" mystring > op
$ vim op
Then use gF
and to come back to file op, use Ctrl + 6
You can load your grep
output in Vim's quickfix list with:
$ vim -q <(grep -rn --include="*.cpp" mystring)
Go to the next occurence with :cn
and to the previous occurrence with :cp
.
See :help -q
and :help quickfix
.
A trick to use vim as a pager is to pass it a hyphen character. This causes it to read from STDIN instead of from file
grep -rn --include="*.cpp" mystring | vim -