3

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)
subrama6
  • 517
  • 1
  • 5
  • 20

4 Answers4

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

Is what you're looking for, I believe.

jkerian
  • 16,497
  • 3
  • 46
  • 59
3

Try this

:vimgrep /whatever/ *.txt *.vb
Virasak
  • 311
  • 1
  • 5
  • great :) as a note to anyone that wants to use this recursively as per my examples above, you can do that with :vimgrep /whatever/ \*\*/*.txt \*\*/*.vb – subrama6 Dec 10 '10 at 16:23
0

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
Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
0

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.

danprice
  • 1,184
  • 1
  • 7
  • 3