How do you search all source code in Vim?
Set grepprg
to Ack, then use :grep
to search with Ack.
Or use ctags.
You may want to check out :vimgrep
and :grep
in the vim documentation. :vimgrep
uses vim's own pattern searching functionality and reads all files into vim buffers. :grep
by default links to an external grep
utlity on your system, but you can change the behavior by setting the grepprg
option. Here's a link to the online docs:
http://vimdoc.sourceforge.net/htmldoc/quickfix.html#grep
There's more info on that and also some other options in the tip on "Find in files within Vim" at the Vim Tips Wiki:
http://vim.wikia.com/wiki/Find_in_files_within_Vim
:vimgrep "pattern" ~/trunk/**/*.py
:copen 20
If you have quite a big project I'd recommend to you to use cscope and vim plugins. Here is one designed to handle big projects: SourceCodeObedience
There is a brief description of how to grep text using SourceCodeObedience.
I use grep directly for that.
grep -IirlZ "pattern" .|xargs -0 vim
-I: ignore binary
-i: ignore case
-r: recursive
-l: print file name only
-Z: print \0 after each file name