Sublime Forum

Folder_exclude_patterns but show in sidebar?


I currently have this in my config to prevent the node_modules folder from being indexed:




If I don’t, re-indexes uses 200-400% CPU for up to a couple of minutes (which surpises me since nothing in the node_modules folder usually changes). The issue is that while node_modules is generally not something I need indexed, I do like it in the sidebar as from time to time, I do go into that code. Is there there a way to omit a folder from indexing but have it show up in the sidebar?


Exclude folders from search but show in side bar

Have you looked at the comments in the default settings? I think binary_file_patterns is what you’re looking for as it states:

“Excludes the matching files from GoTo Anything and Find in Files but not the side bar.”

I haven’t actually tried this, but I imagine something like folder_name/* might work.

1 Like


Yea, that does seem to work, thanks.

1 Like


There is also a index_exclude_patterns patterns which will only exclude files from being indexed but still list them in goto anything/find in files (unlike the binary patterns).

1 Like


It does not work, I’ve been frustrated by this since forever. =(

1 Like


Any updates on a solution for this? Is there a place to make feature requests if it is not possible ATM.

1 Like


realted thread : FindExcludePatterns - Exclusion list for search results
kind of solution: New find in files, exclude dirs?

1 Like


The problem here is that you haven’t actually tried it so your post is mostly irrelevant

There’s still no way to exclude folders from the “Find in folder” search which is a bummer when you work on project with node or bower dependencies

1 Like


You can use /my_folder,-/my_folder/subfolder/* to exclude all files in a subfolder.



Thanks for the tip @wbond, including a folder and excluding children of it is a useful trick.

The problem remains though that binary_file_patterns seems like exactly what I want but it doesn’t work. I tried putting node_modules and node_modules/* and neither worked. I even tried restarting sublime in between the changes

1 Like


Where did you try placing this setting? It only works in the global preferences (Preferences > Settings).

1 Like


That was my problem, I was putting it in project settings. I had to add the following to my global preferences as you said:

"binary_file_patterns": [ "node_modules/*" ]

I had to add the * at the end to get it to work but now it works, thanks!



This is not a solution since it only works as a global setting. I don’t want to exclude folder_name everywhere I use Sublime, I want to only exclude it for a particular project. And, since Sublime also copies fields from Find in Files UI from one Sublime window to every other makes using the UI pretty cumbersome and error prone. (doesn’t anybody else ever have multiple Sublime windows open on different projects?)

Sure wish we had a project-level folder_search_exclude_patterns setting.

1 Like


For project-level settings:

1 Like


Thanks, @leontastic. I have found this before but couldn’t get it to work. On your answer I played again and discovered it works but is inhibited if you add any folder spec to the Find: field in the search input boxes.

1 Like


I could not make it work on project basis, even using .sublime-project or .sublime-workspace.

1 Like


Since Dev build 3158, binary_file_patterns, index_exclude_patterns and index_include_patterns are also supported in project files according to the changelog.

1 Like


Hi, thanks for answering I think I forgot about this post. Later on I discovered what I was doing wrong, I used to start sublime with subl . on my project folder, I used to think that sublime would use whatever .sublime-workspace on the root folder doing this. Then I discovered that this is false and you have to actually do subl <workspace_file> for it to work.

1 Like


For anybody visiting this thread looking for a solution, I managed to get the desired effect by using -*/foldername/* as an exclude filter, as detailed here:

1 Like