Limit File Search Scope in Sublime Text 2
For Sublime Text 3: To exclude from search and GoTo results, without removing from the sidebar, change the "binary_file_patterns"
setting. Matches files AND folders.
For example, to exclude files in "dist" and "node_modules" from GoTo indexing, add this to your User Settings file:
"binary_file_patterns": ["dist/*", "node_modules/*", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"]
I can't figure out how to implement this on a per-project basis :(. Most settings can be moved to a project.sublime-project
file. "Project > Save Project As", save it the root of your project, and add "settings": {...}
to the json in the generated file. (from source, works as of ST3 build 3095). But does not work with "binary_file_patterns".
Add and edit this in your ~/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings
file.
// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
You can exclude certain file patterns and folders from your project by modifying your project settings like so:
{
"folders":
[
{
"path": "src",
"folder_exclude_patterns": ["backup"]
},
{
"path": "docs",
"file_exclude_patterns": ["*.css"]
}
]
}
This is described in the projects documentation.