Search whole project by default with Vim/Ack

I think Rooter is what you want. For example:

let g:rooter_patterns = ['Rakefile', '.git/']

I don't think Ack (or grep/vimgrep) can detect your "project root". If you often work on several projects, you could add this block in your vimrc:

let g:projectA_path="/path/to/A"
let g:projectB_path="/path/to/B"
let g:projectC_path="/path/to/C"

also define some functions/commands, like AckA, AckB, AckC... basically the func/command just does:

exec 'Ack! '. pattern . " " . g:projectA_path

the pattern is the argument you passed in. then, in future, you could do:

:AckA foo

or

:call AckA("foo")

for quick grepping/acking in projectA.

I didn't think of a simpler way to do it. glad to see if there is better solution.

Tags:

Vim

Ack