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

315 Views Asked by At

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 want something that would work kind of like this:

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

There are 4 best solutions below

0
On BEST ANSWER
:vimgrep /whatever/ *.{txt,vb}

Is what you're looking for, I believe.

0
On

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
On

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
1
On

Try this

:vimgrep /whatever/ *.txt *.vb