Byte Friendly

Random thoughts on programming and related topics.

Hide/exclude Directories in TextMate 2

| Comments

I decided to give TextMate 2 another try today. Hopefully it won’t freeze upon trying to install a bundle like it did last time. Now I don’t recall which bundle was that, but so far things are going well. Mostly.

When I opened my Rails app and tried to navigate to file (Cmd+T), I saw this:

At first I thought that these are files from .git folder and spent embarrassing amount of time trying to make TM2 hide that folder. But these are actually temp asset files generated by Sprockets and they reside in tmp/assets/....

Long story short, here’s how you can hide a directory in TextMate 2, both from project browser and navigation dialog.

Create a .tm_properties file. It can be in current project dir or any parent dir (up to $HOME). Put this line into it.

excludeDirectories = "{tmp,}"

It is worth noting that "{tmp}" doesn’t work. Apparently, TextMate glob parser breaks down if it can’t find a comma. So we add one. Alternatively we can use this line:

excludeDirectories = "{$excludeDirectories,tmp}"

It will amend an existing excludeDirectories setting (empty string by default) instead of replacing. And it also has a comma. :)

Hope this post saved you some time.