Exclude files/folders in Sublime Text
While developing NodeJS app, there are too many unnecessary files appear in Go To Anything search. These sublime-settings has made my life easier:
Copy those keys from Settings - Default and paste them to your Settings - User
"folder_exclude_patterns"
This excludes the whole folder from sidebar tree and search. Yeah you will see "node_modules" here.
"file_exclude_patterns"
This excludes the files from sidebar tree and search
"binary_file_patterns"
This excludes the files from search but still shown in sidebar tree
But what if I want to exclude a folder from search but let it be shown in sidebar?
No worries, put "no_search/*" in
"binary_file_patterns": ["no_search/*"]
Alright, here is the full settings from Settings - Default, added some peace of mind. Save, restart ST and enjoy.
{
"folder_exclude_patterns": ["node_modules", ".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"],
"binary_file_patterns": ["generated/*", "*.tbz2", "*.gzip", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
"tab_size": 2,
"translate_tabs_to_spaces": true,
}
Written by Chi Cong Nguyen
Related protips
6 Responses
binaryfilepatterns does not work for folders...
I added folders to my binary file patterns array and it worked for me. "folder/*". No idea if this removes the files from the indexing process, but I would assume so.
I couldn't get the binary_file_patterns
to exclude folders either - using ST3.
How do you use the no_search feature? Let's say I wanted to show the build folder in the tree but excluded it from search. How would you go about setting that up?
"folderexcludepatterns": [
"build",
"nodemodules",
"bowercomponents"
]
This should be added to Sublime Text 3 documentation. Thank you!