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

Allan Odgaard mailinglist at textmate.org
Tue Nov 18 13:35:32 UTC 2014


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 **** "

> […] 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»}`.

> 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


More information about the textmate mailing list