119

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

2 Answers 2

198

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
}
5
  • 10
    Ahhhhhhhh, it was hiding the files I needed. Ahahhahahgghghghghghhg . . . cries
    – meawoppl
    Commented Aug 1, 2014 at 22:43
  • 1
    @Matt I added a reference to the folder pattern because this shows up fairly high in a search I did about them.
    – Nick T
    Commented Jun 7, 2015 at 23:23
  • is there any plugin can switch the pattern?
    – Elaine
    Commented Dec 27, 2016 at 6:58
  • @Elaine yes, plugins can alter the pattern string, you can do so manually by editing the Preferences, you can use language-specific settings, or projects with different values defined within them.
    – MattDMo
    Commented Dec 27, 2016 at 17:19
  • You can also add this for a directory: e.g. "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "__pycache__"], Commented Mar 10, 2019 at 22:40
135

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"]
    }]
}
5
  • Very useful customizing file extensions hided per project.
    – javifm
    Commented Oct 2, 2015 at 10:38
  • 4
    You can also use "binary_file_patterns" to hide the folder/files in search, but still see it in the sidebar.
    – gkiely
    Commented May 26, 2016 at 0:09
  • 9
    For anyone else wondering how to create this file, in the top menu go to Project > Save Project As and you can then paste this into that file and it works. Creating your own file with touch won't work the same :)
    – sofly
    Commented Sep 14, 2016 at 0:48
  • 1
    Thanks! I've been trying to figure out how to hide all the .js files inside of my project's dist folder, but not .js files anywhere else :) first time using the .sublime-project
    – Leon Gaban
    Commented Mar 2, 2017 at 20:27
  • 1
    to hide all dot files in sublime, use ".*" within 'folder_exclude_patterns"
    – Julian
    Commented Aug 2, 2017 at 18:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.