How can I show dotfiles in Textmate 2?

Text EditorTextmate2Dotfiles

Text Editor Problem Overview


I recently upgraded to Textmate 2 and now my dotfiles are not showing up in the file browser. Obviously, this is important when working with stuff like .htaccess files.

Is there a way to enable this feature?

Text Editor Solutions


Solution 1 - Text Editor

Quick solution

Move the focus to the file browser (⌥⌘⇥) and show invisibles (⌥⌘i)(key names: option/alt+command/windows+i/eye). All invisible files will appear in the file browser. Press ⌥⌘i again to hide them.

Permanent solution

If you want to always show some dotfiles (for instance .htaccess), you can either add them in Preferences > Projects > Include files matching… or add the list of files you want to show to the include array in one of:

  • ~/Library/Application Support/TextMate/Global.tmProperties (same as using Preferences)
  • ~/.tm_properties (global)
  • .tm_properties (inside a specific directory/project)

You can add all dotfiles (.*) but I don't recommend it since it can be a lot of clutter. That said, you can also exclude files with the exclude array.

Solution 2 - Text Editor

You can modify the behavior of the file browser via the config file ~/.tm_properties

To list all dotfiles and directories, you can set:

include = "{$include,.*}"

If you want to exclude some of those, for example the .git directory, modify the exclude variable:

exclude = "{$exclude,.git}" 

There are many more options, check the Textmate site as an entry point for whats possible: http://blog.macromates.com/2011/git-style-configuration/

Solution 3 - Text Editor

You can do this in the preferences of Textmate 2.

Navigate to: Textmate -> Preferences -> Projects. You should see two fields, one for including files, and one for excluding. I replaced the value of "Include files matching" with {*,.*} so it includes all normal and hidden files. I then just add the hidden files I want to exclude to the "Exclude files matching" field, such as .git and .DS_Store.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser2693845View Question on Stackoverflow
Solution 1 - Text EditorSimonView Answer on Stackoverflow
Solution 2 - Text EditorkwoodView Answer on Stackoverflow
Solution 3 - Text EditorTomWardropView Answer on Stackoverflow