vimgrep: Searching through multiple file extensions

Here's a neat trick you can do with vimgrep to search through multiple file extensions (for example, finding a reference in all .js and .coffee files).

To find Users in just .js files recursively you would do:

:vimgrep /Users/ **/*.js

To find Users in .js and .coffee files recursively you would do:

:vimgrep /Users/ **/*.js **/*.coffee

This is super useful when you are refactoring code.

I am unsure if Ack.vim can do something similar. If you know, please leave it as a comment!

You can check out some of my other Vim tips here.

9. Jan 2012 Tips · VIM Editor
© Amir Salihefendic