I'm using Vim + Ack.Vim and am flummoxed on how to ignore hits within Jquery files. I've got an .ackrc file defined (see below), but I'm stabbing in the dark.
--type-add=ruby=.haml,.rake,.rsel,.builder
--type-add=html=.html.erb,.html.haml
--type-add=js=.js.erb
--type-add=css=.sass
--type-set=cucumber=.feature
--type-add=jquery=jquery*.js
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
--ignore-dir=coverage
--sort-files
--color
--follow
--group
--nojquery
How would seasoned ack + ack.vim users solve this issue?
Interesting problem! I can think of a few approaches:
I got the last one working. Ack is written in Perl, so it's pretty easy to read and modify. Look for Ack.pm on your system. I use Ubuntu 11.10 and installed ack-grep to get ack; my Ack.pm is found at
/usr/share/perl5/App/Ack.pm
. If you installed the stand-alone version of ack, the file you'll edit is just called "ack". Look for the subroutineis_searchable()
. Here's what I see:Add another line right after above
return 1;
:Again, going back to my first suggestion (patch ack to allow filtering with filename patterns) Andy might take a patch for this.
By the way, you probably already figured this out, but your use of
--type-add
doesn't appear to be valid syntax for the ack command line:it just expects file extensions. Hope this helps!