开发者

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

开发者 https://www.devze.com 2023-01-29 17:49 出处:网络
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 somethin

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

精彩评论

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

关注公众号