Reputation: 12465
How do I let silver searcher ignore certian sub-directories, in my case I want ag to search md format only and ignore all the node_modules
directories, I tried what here silver searcher ignore multiple directories said, but it did not work.
ag --md --ignore-dir={node_modules} foo
I searched the possible solution but found some old issues, e.g, Ignore file in subdirectory not applied properly (opened in 2013) and this New release? opened in 2021
So can this be done ?
Upvotes: 1
Views: 357
Reputation: 12465
There are two answers in the linked Q&A and when I first tried them I did not read the answers carefully, e.g. the highest score one
if it's with just one directory, you'd need to provide a comma, like: ag foo --ignore-dir={dir1,}.
So ag --md --ignore-dir={node_modules,} foo
works but ag --md --ignore-dir={node_modules} foo
does NOT work. My bad!
Or I can just ag --md --ignore node_modules foo
, as here said
--ignore-dir NAME: Alias for --ignore for compatibility with ack.
Upvotes: 1