How can I execute grep through all files included in a file currently open in vim?

Suppose vimthe file is open .hpp:

#pragma once
#include "a.hpp"
#include "b.hpp"
#include "c.hpp"

#include <boost/something.hpp>
// some code

Now let's say that I want to search for any occurrence of the term Tokenin any of the included files (possibly in the files that they also include). How can i make it easy?

I would like to skip any files that cannot be found from my current one vimpath, for example. in this case, I may not be boostin my way, so I would like it to just not search in boost/something.hpp.

+4
source share
2 answers

include-search , vim. , , Token, :

[I          Display all lines that contain the keyword under the
            cursor.  Filenames and line numbers are displayed
            for the found lines.  The search starts at the
            beginning of the file.  {not in Vi}

, :

[<Tab>

26'08".

Vim :

[ CTRL-I    Jump to the first line that contains the keyword
            under the cursor.  The search starts at the beginning
            of the file.  Lines that look like a comment are
            ignored (see 'comments' option).  If a count is given,
            the count'th matching line is jumped to, and comment
            lines are not ignored.  {not in Vi}
+1

. :help include-search Vim. [i, , . -, , :isearch.

0

All Articles