emacsgrepspacemacsemacs-helm

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


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


Solution

  • 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.