I have the situation where I have files with the same name (and similar content) in different sub folders and it is very easy to edit the incorrect file as the two tabs look the same.
A few ways to make this more obvious would be to change the background colour (of the edit window) or the colour of the tab (or text in the tab) based on something in the file path. Is there anyway of achieving such a thing?
I recall you can do something with the window title so this may be one way to help, but using colour would make it easier to see rather than having to read the full path name.
Dave.
--------------------------------------------------------------------- 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.
You could change themes in the editor, this would cause new files to be opened in that theme though.
The .tm_properties file might offer a better solution. See this gist for more info https://gist.github.com/dvessel/1478685.%C2%A0though it seems that as of that doc’s writing the functionality for theme switching wasn’t actually completed. Perhaps you could change fontSize or something else to tip you off?
Graham P Heath
On November 14, 2014 at 11:31:24 AM, Baldwin, Dave (dave.baldwin@intel.com) wrote: I have the situation where I have files with the same name (and similar content) in different sub folders and it is very easy to edit the incorrect file as the two tabs look the same.
A few ways to make this more obvious would be to change the background colour (of the edit window) or the colour of the tab (or text in the tab) based on something in the file path. Is there anyway of achieving such a thing?
I recall you can do something with the window title so this may be one way to help, but using colour would make it easier to see rather than having to read the full path name.
Dave.
--------------------------------------------------------------------- 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.
_______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 14 Nov 2014, at 18:30, Baldwin, Dave wrote:
[…] I recall you can do something with the window title so this may be one way to help, but using colour would make it easier to see rather than having to read the full path name.
Currently only the windowTitle is settable per-file (to get a visual chagne to the window).
I have the issue myself (sometimes a compiler error links to a header file that has been copied to my build directory, which I want to be visually different than regular header files).
Long-term it should be possible to set different themes based on path/file type, just haven’t gotten around to it yet…
My attempt of changing the window title:
windowTitle = "$TM_DISPLAYNAME ${TM_DIRECTORY//Users/davebald/\w+///} ${TM_DIRECTORY/(.*Build.*)/(?1:**** BUILD ****:)/}"
sort of works in that when I am editing a file in the Build directory or sub directory I get the **** Build **** at the end of the window title, but when I am not in a Build directory I get the full path at the end of the window title. 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.
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.
Dave.
On 14/11/2014 13:31, "Allan Odgaard" mailinglist@textmate.org wrote:
On 14 Nov 2014, at 18:30, Baldwin, Dave wrote:
[Š] I recall you can do something with the window title so this may be one way to help, but using colour would make it easier to see rather than having to read the full path name.
Currently only the windowTitle is settable per-file (to get a visual chagne to the window).
I have the issue myself (sometimes a compiler error links to a header file that has been copied to my build directory, which I want to be visually different than regular header files).
Long-term it should be possible to set different themes based on path/file type, just haven¹t gotten around to it yetŠ
textmate mailing list textmate@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.
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
On 18/11/2014 13:35, "Allan Odgaard" mailinglist@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@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.
On 18 Nov 2014, at 15:41, Baldwin, Dave wrote:
Here’s a simpler solution:
[ Build/** ] windowTitle = "$windowTitle **** BUILD **** "
Can you explain what is going on here?
The first line (`[ Build/** ]`) means that settings below that line are only applied to file paths that match the pattern `Build/**`, i.e. files under the `Build` directory.
The next line simply appends a `**** BUILD ****` to the `windowTitle` variable (which has a default value from the default properties file included with TextMate).
Also what is the magic to get the git branch name?
If you use ⌃⌘T (Bundles → Select Bundle Item…) and switch to settings, then enter `windowtitle` and you’ll see that it gets assigned to from `Defaults.tmProperties`. You can select to “edit” it to see the full properties file, which reveal how the default title is constructed.
This is also shown as the syntax:
(?«var»:«if»:«else»)
which is what I have (as far as I can see).
Sorry, I didn’t read your code carefully.
Your issue is that you try to match `Build` and if it matches, replace it with `**** BUILD ****`.
Now, incase you do not match `Build` then no replacement is done, which means the value of TM_DIRECTORY is inserted as-is.
So what you should have used was something like this:
${TM_DIRECTORY/(.*Build.*)|.*/(?1:**** BUILD ****:)/}
Here we always match the entire value of TM_DIRECTORY, and only if capture register 1 is set, do we replace it with `**** BUILD ****`. If nothing is captured, we replace the entire string with nothing.
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.
Right, the manual is still work-in-progress (and very incomplete), but it has the full/exact format string syntax.
The blog post from James has a lot of examples about how to use format strings in practice.
Much clearer now,
Thanks.
On 18/11/2014 15:00, "Allan Odgaard" mailinglist@textmate.org wrote:
On 18 Nov 2014, at 15:41, Baldwin, Dave wrote:
Here’s a simpler solution:
[ Build/** ] windowTitle = "$windowTitle **** BUILD **** "
Can you explain what is going on here?
The first line (`[ Build/** ]`) means that settings below that line are only applied to file paths that match the pattern `Build/**`, i.e. files under the `Build` directory.
The next line simply appends a `**** BUILD ****` to the `windowTitle` variable (which has a default value from the default properties file included with TextMate).
Also what is the magic to get the git branch name?
If you use ⌃⌘T (Bundles → Select Bundle Item…) and switch to settings, then enter `windowtitle` and you’ll see that it gets assigned to from `Defaults.tmProperties`. You can select to “edit” it to see the full properties file, which reveal how the default title is constructed.
This is also shown as the syntax:
(?«var»:«if»:«else»)
which is what I have (as far as I can see).
Sorry, I didn’t read your code carefully.
Your issue is that you try to match `Build` and if it matches, replace it with `**** BUILD ****`.
Now, incase you do not match `Build` then no replacement is done, which means the value of TM_DIRECTORY is inserted as-is.
So what you should have used was something like this:
${TM_DIRECTORY/(.*Build.*)|.*/(?1:**** BUILD ****:)/}
Here we always match the entire value of TM_DIRECTORY, and only if capture register 1 is set, do we replace it with `**** BUILD ****`. If nothing is captured, we replace the entire string with nothing.
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.
Right, the manual is still work-in-progress (and very incomplete), but it has the full/exact format string syntax.
The blog post from James has a lot of examples about how to use format strings in practice.
textmate mailing list textmate@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.