参考:https://blog.csdn.net/zhang2531/article/details/51579863
问题:
当前文件查找 def test_,列出全部匹配内容
解决:
方式一:
:g/def test_/p
此方式列表无法选择 【 popexizhi:pope还没找到】
方式二
:vimgrep /def test_/ %
:copen
此方式匹配列表可以选择
参考:
vimgrep /匹配模式/[g][j] 要搜索的文件/范围
g:表示是否把每一行的多个匹配结果都加入
j:表示是否搜索完后定位到第一个匹配位置
vimgrep /pattern/ % 在当前打开文件中查找
vimgrep /pattern/ * 在当前目录下查找所有
vimgrep /pattern/ ** 在当前目录及子目录下查找所有
vimgrep /pattern/ *.c 查找当前目录下所有.c文件
vimgrep /pattern/ **/* 只查找子目录
例子:
:vimgrep /flash/gj **/*.as 搜索当前目录以及所有子目录内as文件中的'flash'
:vimgrep /an error/gj *.c 在所有.c文件中搜索an error
:vimgrep /an error/gj * 在当前目录下的文件搜索an error,不包括子目录
cn 查找下一个
cp 查找上一个
copen 打开quickfix
cw 打开quickfix
cclose 关闭qucikfix
help vimgrep 查看vimgrep帮助
没有评论:
发表评论