5

Been a user of Alfred for a long time, however whenever I search anything I get a lot of FUD results due to alfred also indexing all my web project node_modules directories.

Is there any way to path-match and exclude all results from within a /node_modules/ directory? This would greatly improve the utility of the search.

  • Look into using a script filter, which allows you to customise the results returned in the Alfred search box. But they’re also quite a ball ache to set up. – CJK Jan 25 '18 at 9:14
5

Go to Preferences -> Spotlight -> Privacy (TAB) Then add the folders you want to exclude to that list.

| improve this answer | |
  • 1
    A couple things seem missing. How does this match paths for dozens or hundreds of folders? Are you saying Alfred only uses spotlight? – bmike Nov 30 '18 at 12:03
  • In Alfred 4 there is no "Spotlight" tab anymore – Paul Razvan Berg Nov 23 '19 at 14:47
  • @PaulRazvanBerg They mean System Preferences, not Alfred Preferences. System Preferences has a Spotlight section, and that has a Privacy tab; but it does seem to only list specific folders, rather than being able to specify a pattern (e.g. "ignore node_modules everywhere you see it"). – gimboland Feb 26 at 10:41
2

You can also add alfred:ignore to the spotlight comments of the folder that you want exclude, in your case the node_modules folder.

| improve this answer | |
1

This issue has been in discussion on the Alfred Forum since 2013 and unfortunately the answer is that Alfred can't really omit "node_modules" without you tagging all folders with the alfred:ignore tag. This would of course involve yet another script so it's overkill.

There is an alternative solution though: switch to yarn 2 and this issue with Alfred will implicitly go away! They built a new system-wide caching mechanism which avoids installing "node_modules" in every node project.

https://github.com/yarnpkg/berry

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .