118

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

197

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
}
7
  • 13
    It's probably simpler to just say: the settings files are written in JSON.
    – pdpi
    Feb 17, 2014 at 11:46
  • 10
    Ahhhhhhhh, it was hiding the files I needed. Ahahhahahgghghghghghhg . . . cries
    – meawoppl
    Aug 1, 2014 at 22:43
  • 1
    Thanks - just made my development experience a whole lot better :) Apr 27, 2015 at 8:45
  • 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
    Jun 7, 2015 at 23:23
  • is there any plugin can switch the pattern?
    – Elaine
    Dec 27, 2016 at 6:58
136

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
    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
    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
    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
    Mar 2, 2017 at 20:27
  • 1
    to hide all dot files in sublime, use ".*" within 'folder_exclude_patterns"
    – Julian
    Aug 2, 2017 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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