How can I exclude a folder from indexing in Sublime Text, while still showing it in the sidebar?
Solution 1:
To exclude files from the index but keep them in the sidebar, use the binary_file_patterns
setting in your User Settings, for example:
"binary_file_patterns": [
"*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds",
"*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip",
"node_modules/**",
"bower_components/**"
]
Make sure to copy the values from your Settings - Default
preferences (here shown as "*.jpg"
etc.), or you will start indexing binary files.
Solution 2:
You can change your personal settings, in Preferences -> Settings - User
, add:
{
"folder_exclude_patterns":
[
".svn", ".git", ".hg", "CVS",
"node_modules",
],
}
Solution 3:
Sublime Text 3 now provides a way to exclude files and folders from indexing while keeping them in the sidebar:
"index_exclude_patterns": [
"*.log",
"node_modules/*"
]
On my project I observed the following improvement in the indexing status menu after applying changes:
Before:
index "MyApp" collated in 0.70s from 73934 files
index "MyApp" is using 15167488 bytes for 54234 symbols across 1357673 locations
After:
index "MyApp" collated in 0.00s from 137 files
index "MyApp" is using 61440 bytes for 730 symbols across 4763 locations
Solution 4:
Doesn't work in ST3 (Build 3126).
You can show node modules folders in sidebar and hide files inside this way :
"file_exclude_patterns":
[
...,
"node_modules/**"
]
If you want to hide subfolders from each node module :
"folder_exclude_patterns":
[
"node_modules/*/**"
]
All files inside node_modules will be removed from search, but each node_module subfolder will be still visible in sidebar.