Last Updated: March 28, 2016
· javiercr

Hide cache folders (or any folder) in Sublime Text 2

When working on a Rails project with Sublime Text 2 if you're using for instance SCSS files, those files will be compiled to my_app/tmp/cache and they will show up when doing a search or when using the "go to file" shortcut (⌘ + T), pretty annoying.

To avoid seeing these files (or any other folder in the project) go to User Settings (⌘+ ,) and add this line:

"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "tmp/cache"]

Thereby anything inside my_app/tmp/cache will be invisible.

If you prefer you can use patterns to match file names instead of directories:

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

Finally you can use both tricks in a project basis if you save the project (Project » Save project As) and then edit its settings (Project » Edit project):

      "folder_exclude_patterns": ["tmp/cache"]

Happy coding!

5 Responses
Add your response

Awesome. Just got into Sublime Text 2.
Every little tid bit like this helps.

over 1 year ago ·

This is gold! The .sass-cache folder from the Compass Framework really bugged me, now those pesky files no longer show up :)

over 1 year ago ·

Glad it helps :)

over 1 year ago ·

Great tip. I'll use this a lot at work!

over 1 year ago ·

Consider using "binary_file_patterns" instead if you don't want to hide the files from the sidebar. Use a trailing / to denote folders e.g. ".git/"

over 1 year ago ·