假设我在
vim中打开了以下.hpp文件:
#pragma once #include "a.hpp" #include "b.hpp" #include "c.hpp" #include <boost/something.hpp> // some code
现在,假设我想在任何包含的文件中搜索任何出现的Token一词(也可能在它们包含的文件中).我怎么能这么容易做到?
我想跳过任何不能从我当前的vimpath中找到的文件,例如在这种情况下,我的路径可能没有提升,所以我希望它不要在boost / something.hpp中搜索.
解决方法
您可以使用vim中提供的
include-search功能.特别是,当您将光标放在该单词上时,这是搜索所有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>
取自Bram的演讲Seven habits of effective editing时间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}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。