Search code examples
sublimetextsublimetext3

Sublime Text 3 - hide unwanted folders in left pane


So I have a folder open in Sublime Text 3.
This folder contains a structure like this:

src  
build        // I would like to hide this folder
.sass-cache  // and this folder
node_modules // and this folder
task
test

In the folders pane on the left (the sidebar), I get the above folders. I would like to hide some of them from view and only see the remaining folders.

Is there a way to achieve folder hiding using a list or another file which is loaded on launch?

I was thinking something like a .gitignore file or such, which just lists folders or patterns to hide things from view.


Solution

  • You need to set "folder_exclude_patterns" and/or "file_exclude_patterns" in your preferences. The defaults are as follows:

    "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
    "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"]
    

    Select Preferences -> Settings—User, then add the following line:

    "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules", ".sass-cache", "build"]
    

    If you are working in a project, select Project -> Edit Project, and add the line above to the "settings" dict. In both cases, make sure the file is valid JSON.