How to tell grep to ignore folders in Spacemacs project keyword/symbol search?

744 views Asked by At

In spacemacs you can spc s p to find keywords within your project, in my case Spacemacs uses grep as it is the first search tool it finds according to its dotspacemacs-search-tools configuration.

My problem is that in projects where I have a folder with compiled javascript, Helm/Grep looks for said keyword within those folders, making Spacemacs either freeze or sometimes crash, how can I tell Helm (within the context of Spacemacs) to ignore such folders?

Here is an example of how it looks like: enter image description here

I've tried looking for some clues in the help section of (C-c ?) but haven't found anything yet.

Any help is appreciated :)

Edit/Update: Bahman's answer is in fact correct. Note however that in my case I had to also include a directory inside "projectile-globally-ignored-directories" configuration in order to work:

enter image description here

2

There are 2 answers

3
BahmanM On BEST ANSWER

Usually, Emacs search (grep/ag/...) commands have an ignored-directories customization option exposed as a list.

Based on the screenshot, I think you're using helm-grep.

You can simply evaluate the following or add it to your Emacs config:

(add-to-list 'helm-grep-ignored-directories "node_modules") 

You can also M-x customize and then search for "helm-grep" to view/edit any of its options including ignored directories.

0
Ilídio Martins On

Use AG Search instead

enter image description here

Because AG Search is more integrated and polish, and the other methods weren't improved or fixed to work well with this Ignore options.

When I tested the other methods (grep/ag/...) they didn't perform as expected. Like for example they didn't ignore folders in the search and they purely search for everything in any folder. They will need more development to work as expected.