[TxMt] tab title preference

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[TxMt] tab title preference

Koen Punt
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:



But if it could be possible to include the name of parent directory, that would make it usable.

Koen

Sent from Nylas N1, the extensible, open source mail client.


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

Igor Kozlov
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.


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

Koen Punt
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, the extensible, open source mail client.

On Nov 1 2016, at 4:55 pm, Igor Kozlov <[hidden email]> 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.


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

Igor Kozlov
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
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

George McGinley Smith
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 <[hidden email]> 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
[hidden email]
http://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

Allan Odgaard-4

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'


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

Allan Odgaard-4
In reply to this post by Igor Kozlov

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.



_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

[TxMt] Re: tab title preference

George McGinley Smith
In reply to this post by Allan Odgaard-4
On Thu, 3 Nov 2016 at 18:31 Allan Odgaard <[hidden email]> wrote:

So this should work:

windowTitle = '${TM_DIRECTORY:+${TM_DIRECTORY/^${projectDirectory}(?:\/(.+))?/${1:+$1/}/}}$TM_DISPLAYNAME'
Thanks, that's exactly what I was after


_______________________________________________
textmate mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate