[TxMt] Re: Changing background colour based on file name

Baldwin, Dave dave.baldwin at intel.com
Tue Nov 18 14:41:37 UTC 2014



On 18/11/2014 13:35, "Allan Odgaard" <mailinglist at textmate.org> wrote:

>On 18 Nov 2014, at 14:10, Baldwin, Dave wrote:
>
>> My attempt of changing the window title:
>>
>> windowTitle = "$TM_DISPLAYNAME ­
>> ${TM_DIRECTORY/\/Users\/davebald\/\w+\///}
>> ${TM_DIRECTORY/(.*Build.*)/(?1:**** BUILD ****:)/}"
>
>Here’s a simpler solution:
>
>     [ Build/** ]
>	windowTitle = "$windowTitle **** BUILD **** "

Can you explain what is going on here?  Also what is the magic to get the
git branch name?

>
>> […] I though the ?1:Š:Š replacement is saying if capture 1
>> exists use the first Š as the replacement string else use the second
>> Š as
>> the replacement string.
>
>No, a question mark is missing, the correct syntax is:
>`${«var»:?«if»:«else»}`.


This is also shown as the syntax:

(?«var»:«if»:«else»)

which is what I have (as far as I can see).


>
>> Searching on the internet and in the TM2 manual has turned up a dearth
>> of
>> information on format strings.  The article by James Gray in 2011 was
>> about the only reference, but trying to deduce the syntax from the
>> examples doesn¹t make for good documentation in my opinion.
>
>The manual has the full syntax here:
>http://manual.textmate.org/references.html#format-string


I was aware of this but without some explanation it is too cryptic and I
am sure the majority of TM users are in the same boat.

Dave.

>
>_______________________________________________
>textmate mailing list
>textmate at lists.macromates.com
>http://lists.macromates.com/listinfo/textmate

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the textmate mailing list