Hi,
I remember something about customizable tab titles, but couldn't find what I was looking for in the archives.
So here's the question; there's a windowTitle property for .tm_properties, but is something like that also possible for tab titles? Because I'm currenty working on a project with a lot of identical named files:
My tabs currently look like this:
![](cid:8qt37fho32irekzs691r0yrn6)
But if it could be possible to include the name of parent directory, that would make it usable.
Koen
Sent from [Nylas N1](https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz /local-eb0dadc9-7075/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=dGV4 dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=), the extensible, open source mail client.
That would require the tabs to track and compare filenames, which I imagine can be expensive. And also, what if the parent directory also matches with the parent of a different file? With an option like windowTitle (I suggest tabTitle), TextMate doesn't have to make a best guess.
Koen
Sent from [Nylas N1](https://link.nylas.com/link/33wd9n5m5l3cdcz4d1oikbwcz /local-d0a8883c-3758/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=dGV4 dG1hdGVAbGlzdHMubWFjcm9tYXRlcy5jb20=), the extensible, open source mail client.
On Nov 1 2016, at 4:55 pm, Igor Kozlov me@igorkozlov.me wrote:
My tabs currently look like this:
<Pasted File.png>
Having the same trouble working with JS. Ideally TM could do this
automatically.
If there are two or more tabs with the same name, then show the directory
name too.
That would require the tabs to track and compare filenames, which I imagine can be expensive. And also, what if the parent directory also matches with the parent of a different file? With an option like windowTitle (I suggest tabTitle), TextMate doesn't have to make a best guess.
Getting the name of the directory the moment tab opens and keeping it in the memory is not expensive at all. Then it's just comparing strings and deciding whether to show the directory name or not. Since TM renders usually around 10 tabs max it should not affect performance.
I don't like the tabTitle option, because the majority of files are still pretty unique and don't need any additional detailing.
I use this so I have the full project path in the title bar:
windowTitleFile = '${TM_DIRECTORY:+${TM_DIRECTORY//path/to/project///}}/$TM_DISPLAYNAME ' windowTitle = '$windowTitleFile$windowTitleSCM'
I'd love it if I could make the path/to/project use the $TM_PROJECT_DIRECTORY though…
On Tue, 1 Nov 2016 at 20:16 Igor Kozlov me@igorkozlov.me wrote:
That would require the tabs to track and compare filenames, which I imagine can be expensive. And also, what if the parent directory also matches with the parent of a different file? With an option like windowTitle (I suggest tabTitle), TextMate doesn't have to make a best guess.
Getting the name of the directory the moment tab opens and keeping it in the memory is not expensive at all. Then it's just comparing strings and deciding whether to show the directory name or not. Since TM renders usually around 10 tabs max it should not affect performance.
I don't like the tabTitle option, because the majority of files are still pretty unique and don't need any additional detailing.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 3 Nov 2016, at 14:02, George McGinley Smith wrote:
I'd love it if I could make the path/to/project use the $TM_PROJECT_DIRECTORY though…
You can, though the variable is projectDirectory and you must use the ${variable} syntax when putting variables (for TextMate to expand) inside of regular expressions.
So this should work:
windowTitle = '${TM_DIRECTORY:+${TM_DIRECTORY/^${projectDirectory}(?:/(.+))?/${1:+$1/}/}}$TM_DISPLAYNAME'
I added logic to only add path-separator (`/`) when there is more to `TM_DIRECTORY` than just the project directory.
You can use `$windowTitleSCM` as suffix for the above window title to get SCM info added (when present).
For the records, this is the default window title and related variables that can be re-used in custom window titles:
windowTitleSCM = '${TM_SCM_BRANCH:+ ($TM_SCM_NAME: $TM_SCM_BRANCH)}' windowTitleProject = '${projectDirectory:+ — ${projectDirectory/^.*///}}' windowTitle = '$TM_DISPLAYNAME$windowTitleProject$windowTitleSCM'
On Thu, 3 Nov 2016 at 18:31 Allan Odgaard mailinglist@textmate.org wrote:
So this should work:
windowTitle = '${TM_DIRECTORY:+${TM_DIRECTORY/^${projectDirectory}(?:/(.+))?/${1:+$1/}/}}$TM_DISPLAYNAME'
Thanks, that's exactly what I was after
On 1 Nov 2016, at 22:54, Igor Kozlov wrote:
Having the same trouble working with JS. Ideally TM could do this automatically. If there are two or more tabs with the same name, then show the directory name too.
Yes, this is a TODO-item.
The previous thread about changing the tab titles though was from a user who wanted _shorter_ tab titles.