How can I exclude a folder from indexing in Sublime Text, while still showing it in the sidebar?

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.


You can change your personal settings, in Preferences -> Settings - User, add:

{
    "folder_exclude_patterns":
    [
        ".svn", ".git", ".hg", "CVS",
        "node_modules",
    ],
}

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