Excluding folders from indexing in Sublime

Read in 1 minute ·

Sometimes we work in projects with tons of Javascript dependencies. Folders like node_modules and bower_components are a pain in the neck because every time that we need to find something in the project the content of these folders will be used in the search.

Sublime offers 2 settings to hide these files from the index. First of all, open the User Preferences (Preferences -> Settings – User):

  • binary_file_patterns: This option excludes files from the index but keep them in the sidebar.
  • folder_exclude_patterns: This option excludes files from the index and sidebar. This is why, for example, you don’t see the .git folder in a project.

My final setting is:

"binary_file_patterns":
	[
		"*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip",
		"node_modules/**",
		"bower_components/**",
		"tmp/**"
	]

I also decided to add it the tmp folder, which is used by all kind of frameworks.

Avatar photo If you like my content, follow me on Twitter and GitHub

Comments

comments powered by Disqus