Sublime Forum

Folder_exclude_patterns but show in sidebar?

#1

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

[code]“folder_exclude_patterns”:

".git",
".svn",
".sass-cache",
"node_modules"

],[/code]

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?

2 Likes

Exclude folders from search but show in side bar
#2

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

#3

Yea, that does seem to work, thanks.

1 Like

#4

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

#5

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

1 Like

#6

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

1 Like

#7

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

1 Like

#8

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

#9

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

4 Likes

#10

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

#11

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

1 Like

#12

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!

3 Likes

#13

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

#14

For project-level settings: https://www.sublimetext.com/docs/3/projects.html

1 Like

#15

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

#16

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

1 Like

#17

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

#18

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

#19

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