If you’ve started using ctags to browse your scala sources, one thing that you might find annoying is that when you do a file search, it also searches through your .ctags_srcs directory and your .tags files. Most of the time this is not what you want. So how do you go about excluding these directories and files from your search?

Find without exclude

When doing a Find in Files… (CMD + SHIFT + F), you can exclude directories and files you don’t want with a minus sign in front of them in the Where box. Multiple clause are separated by commas.

To exclude a directory and all the files there in you need to also use a wildcard (*) following the directory.

For example to exclude all files in the .ctags_srcs directory use:

-.ctags_srcs/*

To exclude single files simply use its name. For example to exclude the .tags file use:

-.tags

Here’s a full list of excludes to exclude all ctag directories and files along with the target directory, the sublime-workplace file and any xml files:

<project>, -.ctags_srcs/*, -.tags, -target/*, -*.sublime-workspace, -*.xml
Find with exclude

And that’s all there is to it.