Web Development

Sublime Text – Exclude Files or Directories from Go To Anything Feature

Tired of seeing unnecessary files from Sublime Text’s CTRL+P or Go To Anything search feature? Want to get rid of those generated files like minified CSS/JS or generated from templating engines? Want to get rid of them from search but still need to see them in sidebar? There is a config for that!

Declare as binary files

There are several configurations that can be set so that specific file name patterns can be excluded from search, however, some of them will result to having these files removed from the sidebar. A trick is to declare these files are binary so that search feature would exclude them.

On Preferences -> Settings – Default, look for binary_file_patterns config value. Copy the entire config values and go to Preferences -> Settings – User. Add binary_file_patterns config to it and append the additional patterns that suits your need. See example below.

{
    ...
    "binary_file_patterns": ["<existing file patterns>", "compiledtemplate_*", "generated_files/*", "*.min.js", "*.min.css"],
    ...
}

That’s it.

Leave a reply

Your email address will not be published. Required fields are marked *