Lugo Labs

Exclude files and folders from search in Sublime Text 3

I love Ruby on Rails' Asset Pipeline, but it does add a lot of cache files during development inside the tmp folder. So every time I searched for files (CMD+P on OSX, CTRL+P on Windows), I had all these files with long names I had to skip through.

So today I said, that's enough, there has to be a better way. And thanks to Google and StackOverflow I now have the solution that saved my life.

On Sublime Text 3, go to the top bar Sublime Text > Preferences > Settings User (it might be slightly different in Windows) and add the following lines:

js
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "tmp"]

The first line will exclude any files with the specified extensions from search; whereas the second will exclude the specified folders. Look at my tmp folder at the end of the second line (sigh!). Of course, you can add or remove files and folders as you please.

Happy days!