9

I'm moving from Textmate to vim (with janus) and want to exclude some directories from Ack in particular, and also NERDTree.

The reason I want to do this is that Ack is useless (takes minutes to run, and produces no results) with one of my large projects which contains a directory full of marshalled db data (with many subdirectories and hundreds of thousands of files).

I know how to exclude files (not directories) from NERDTree, and also exclude patterns from CommandT. Neither of these solve my Ack issue.

I'm a complete vim n00b. Thanks for reading.

i2w
  • 118
  • 2
  • 6
  • 1
    What options do you use for Ack? `--ignore-dir=nameOfDirectory` will ignore `nameOfDirectory`. – romainl Jun 27 '11 at 11:58

3 Answers3

10

By default, ack only checks your ~/.ackrc file for it’s default switches. You can have per directory ack settings if you add this to your .bash_profile:

export ACKRC=".ackrc"

http://www.rustyrazorblade.com/2012/03/making-better-use-of-your-ackrc-file/

philfreo
  • 41,941
  • 26
  • 128
  • 141
  • Actually ack looks in _multiple_ locations for .ackrc. Not just ~/.ackrc. Please refer to the ack documentation https://beyondgrep.com/documentation/ack-2.24-man.html#ackrc_location_semantics. It looks at all the locations, global, user and project. – Les Nightingill Sep 02 '18 at 13:28
4

For NerdTree, use NERDTreeIgnore setting.

as for Ack - you can set --ignore-dir flag in your .ackrc (as explained in Ack's man page)

lukaszkorecki
  • 1,743
  • 1
  • 15
  • 19
  • 2
    Thanks. So it's not possible to do exclude directories from Ack on a per-project basis? – i2w Oct 18 '11 at 11:00
  • 1
    You could create a wrapper script which sets ACK_OPTIONS per project basis, so it would be something like `ACK_OPTIONS=--ignore-dir=lolwut ack $1` and use it instead of `ack` command. – lukaszkorecki Oct 19 '11 at 10:28
  • I think this is the best I can get. Thanks! – i2w Oct 26 '11 at 12:52
0

I only had to create a .ackrc in my top directory with the following:

--ignore-dir=log/
Abdo
  • 13,549
  • 10
  • 79
  • 98