开发者

is there any way to vimgrep, limiting to >1 but not all types of files?

i'm pretty used to doing either:

:vimgrep /whatever/ **/*

or

:vimgrep /whatever/ **/*.txt

but is there a way with vim globbing to do, say, 2 file types? i guess i w开发者_如何转开发ant something that would work kind of like this:

:vimgrep /whatever/ \*\*/.(txt|vb)


:vimgrep /whatever/ *.{txt,vb}

Is what you're looking for, I believe.


Try this

:vimgrep /whatever/ *.txt *.vb


I don't use vimgrep, but an (undocumented) external perl wrapper around find+grep+xargs. From vim, your search would become:

:Searchfile txt,vb whatever


You might be interested in a plugin I wrote called EasyGrep. It allows you to automatically search for files that match the one you're editing (with an option for recursive search) as well as files that are related to the current file.

For example: when test.cpp is open, files that match any one of *.cpp *.hpp *.cxx *.hxx *.cc *.c *.h will be searched when a search is initiated. You can also define your own relationships or create a custom one on demand.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜