sublimetext2sublimetext3sublimetext

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


For a large project with many dependencies e.g. in the node_modules/ folder, I noticed frequent CPU spikes because of Sublime indexing all the files in the folder.

I know I can hide files and folders using the folder_exclude_patterns setting, but I still want the folder to be visible in the sidebar.

How can I keep e.g. node_modules/ in the sidebar, but exclude it from indexing?


Solution

  • 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.