Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In TextMate 2, is it possible to change the title of the open tabs?

In TextMate 2, when you have multiple documents open at once, and they appear in a row of tabs on the main window, is there a way to change the text (filename) shown in each tab?

By default, it shows the file's basename (the filename without any path information). I don't want full path information displayed on each tab, but I would love to have the file's current_directory/filename on each tab.

(In .tm_properties, I did set windowTitle = $TM_FILEPATH to show the full filepath at the top of the main window, so I at least have that.)

To illustrate what I'm asking, if I have a set of files open as such:

  • /Users/me/projects/code/lib/Shapes.pm
  • /Users/me/projects/tmp/Shapes.pm
  • /Users/me/projects/var/data/Shapes.pm

This is what the tabs currently look like:

Shapes.pm | Shapes.pm | Shapes.pm

What I would prefer is to see is:

lib/Shapes.pm | tmp/Shapes.pm | data/Shapes.pm

i.e., each file's current directory prepended to the filename itself. A Perl regex would make easy work of getting that. Does TextMate 2 give you the ability to modify the "tab title" per above? Thanks!

like image 886
user3112401 Avatar asked Nov 03 '15 16:11

user3112401


1 Answers

Since TextMate v2.0-rc.8 (2018-03-08, installable when enabling "nightly builds") the tab title can be configured in the same manner you would do with the window title.

For example, the following configuration would give you the filename, prefixed with the name of the immediate parent directory.

tabTitle = "${TM_DIRECTORY/^(.*[\/])//}/$TM_DISPLAYNAME"

tabs

like image 87
Koen. Avatar answered Sep 29 '22 13:09

Koen.