Hide files with certain extension in Sublime Text Editor?

SublimetextSublimetext3

Sublimetext Problem Overview


is it possible to hide all the files with certain extension from the sidebar (lateral nav bar) in Sublime Text Editor 3?

Sublimetext Solutions


Solution 1 - Sublimetext

Are you talking about the sidebar? For example, if you select File → Open and select a folder, then the folder and its contents are displayed along the left side, allowing you to navigate amongst its contents and sub-directories. If that is the case, then the answer is yes, files can be excluded.

Select Preferences → Settings – Default to open a tab called Preferences.sublime-settings – Default. This file is read-only, so you'll also need to open Preferences → Settings – User. The first time you open your user preferences it will be blank. It (and all Sublime config files) are in the JSON format, so you'll need opening and closing curly braces at the beginning and end of the file, respectively:

{

}

Activate the default preferences tab and search for file_exclude_patterns (which is on line 377 in ST3 build 3083) and also folder_exclude_patterns if desired. Copy its contents to your user preferences file, like so:

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

and feel free to add your own customizations. Please note that there is no comma (,) after the closing square bracket, as in this example this is the only customized preference. If you have multiple ones (changing fonts, window options, themes, or whatever) you'll need a comma after each item except the last one (trailing commas are illegal JSON):

{
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": true,
    "wrap_width": 0
}

Solution 2 - Sublimetext

You can also set them up per project and ignore folders, in your .sublime-project file, e.g.:

{
    "folders": [{
        "path": ".",
        "folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
        "file_exclude_patterns": ["*.pyc", "*.pyo", ".project"]
    }]
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSovosView Question on Stackoverflow
Solution 1 - SublimetextMattDMoView Answer on Stackoverflow
Solution 2 - SublimetextPanchaGilView Answer on Stackoverflow