如何排除vimgrep中的文件模式? [英] How to exclude file patterns in vimgrep?
问题描述
map< leader> s:executenoautocmd vimgrep / \\< 。展开(< cword>)。 \\> / gj ** / *。*< Bar>
cw< CR> 5
问题是有一些临时的子文件夹(如obj,objd),我不想要搜索。如何排除与给定模式相匹配的子文件夹。例如,前缀objd的子文件夹不应包含在搜索中。
截至Vim 7.3.570,您可以使用wildignore可以使用vimgrep排除模式。
例如,忽略objd子文件夹:
:set wildignore + = objd / **
可以通过分离添加额外的排除具有逗号的模式:
:设置wildignore + = objd / **,obj / **,*。tmp,test.c
有关详细信息,请参阅Vim的帮助文档。
:help wildignore
In vim, I do search with vimgrep frequently. I have mapping like below:
map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar>
cw<CR> 5
The problem is that there are some temporary subfolders (like obj, objd) that I don't want to search for. How can I exclude subfolders matching given patterns. For example, subfolders with prefix "objd" should not be included in searching.
As of Vim 7.3.570, you can use wildignore to exclude patterns with vimgrep.
For example, to ignore the objd subfolder:
:set wildignore+=objd/**
Additional exclusions can be added by separating patterns with a comma:
:set wildignore+=objd/**,obj/**,*.tmp,test.c
See Vim's help documentation for a few more details.
:help wildignore
这篇关于如何排除vimgrep中的文件模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!