Sublime Forum

Remove pattern from file_exclude_patterns

#1

How can I remove a pattern from the global file_exclude_patterns on project level? To me it looks like I only can add stuff to the global excludes.

0 Likes

#2

Perhaps file_include_patterns will do what you want? Source: http://www.sublimetext.com/docs/3/projects.html

0 Likes

#3

file_include_patterns does not help. According to my observations the resulting set of files is computed as included_files \ excluded_files.

0 Likes

#4

I’m configuring my Sublime Text 4 project and have encountered a challenge with file_exclude_patterns too.

project file:

"folders":
[
    {
        "path": "/some/folder",
        "file_exclude_patterns": [ "*.bak" ] // exclude only these files
    }
]

in global settings, we have by default big list of exclusions:

global config:

"file_exclude_patterns": [ "*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", ".directory", "desktop.ini", "*.class", "*.psd", "*.db", "*.sublime-workspace",
    ],

I also can debug this in the console:

view.settings().get('file_exclude_patterns')

but it shows globals,
and if I check if that loaded, I do:

>>> view.window().project_data().get('folders', [])
[{'file_exclude_patterns': ['*.bak'], 'path': '/some/folder'}, 

Does it mean it is “added” to global settings, not overlapping?

But any way to overlap, or what is the better way to trick this?

how to solve this need if I need to stop excluding globally excluded files (a few of them)?

0 Likes

#5

As far as I’m aware, the global and project versions of these are additive; setting the setting on a particular folder augments the global setting for that particular folder to also add/remove files or folders, depending on which of the settings you use.

The general idea is, I believe, that the global settings are the files and folders that you never want to see, and then you can augment that on a per project basis.

Observably, you can’t have a file_include_patterns in a folder that specifically tells it to display files that are globally excluded.

As such if you need for some things to display files that are globally excluded, you may need to just remove them from the global exclusion list and then manually add them to the projects where you need them.

0 Likes