Ignoring files and folders in Sublime Text

I love the file search (ctrl+shift+f) and quick navigate (ctrl+p) in Sublime Text. What can be annoying however is when these present you with library code in your project, files related to source control, binary files or minified files.

Since I keep forgetting how to clean that up, here’s a note to self (and others) on how to clean that up. Easy peasy.

  1. Save as project (if you haven’t already)
  2. Edit project file
  3. Add file_exclude_patterns and/or folder_exclude_patterns to the folders section.

Below is an example from one of my current projects which excludes the git repo folder, a cache folder, minified files and some binary files.

{
    "folders":
    [
        {
            "file_exclude_patterns":
            [
                "*.mp3",
                "*.ogg",
                "*.pdf",
                "*.min.*"
            ],
            "folder_exclude_patterns":
            [
                ".git",
                ".cache"
            ],
            "path": "/D/dev/www/sdaweb-ssl"
        }
    ]
}