Hi again,
After playing around with it it only works if there is nothing before it. When I start a line with then I have 2 different colors one for % and one for the name of the array. But the moment I put even a space before the %array or declare it or it's inside a parenthesis of a function then it does not work it gets a generic color...
Thanks for your help in advance.
Best, John
Message: 6 Date: Fri, 14 Oct 2011 04:54:17 -0400 From: DZ-Jay dz@caribe.net To: TextMate users textmate@lists.macromates.com Subject: [TxMt] Re: Coloring Syntax Message-ID: 10089806-887A-43E8-BED0-241FD2E1BEAA@caribe.net Content-Type: text/plain; charset=us-ascii
Hello John,
You can match multiple tokens on the same line and assign them to different coloured groups like this:
{ name = 'meta.entity.ksp'; match = '^(%)([a-zA-Z0-9_]\w*)'; captures = { 1 = { name = 'punctuation.ksp'; }; 2 = { name = 'entity.ksp'; }; }; },
Notice that both tokens to be identified have parentheses around them in order to be captured. The "captures" list follows standard regexp convention, that is, 0 is the matched string, 1 is the first matched group in parentheses, 2 is the second matched group, and so on.
Not specifying the "captures" list (like in your example) is the same as using capture "0," which is the entire matched string.
In my example, I assigned a different syntax scope identifiers to each token, allowing me to colour them individually.
By the way, the character class "[a-zA-Z0-9_]" is exactly what "\w" represents, so you could shorten your pattern to,
match = '^(%)(\w+)';
which matches at least one, possibly more, contiguous word characters.
I hope this helps.
dZ.
On Oct 11, 2011, at 13:27, John Relosa wrote:
Hello,
I have a question about syntax coloring. I am using the below code to signify that this is let's say an entity scope
{name = 'entity.ksp'; match = '(%)[a-zA-Z0-9_]\w*'; },
% is actually the signifier for a variable array so when I go to the preferences and change the scope to entity then those words that start with %array get a certain color.
The problem is that the whole word including the "%" symbol gets colored.
So here is my question to the textmate gurus.
Is there a way to have the "%" symbol a different color and the word array a different color?
What would be the code to accomplish that. Any pointers or ideas would be appreciated.
Thank you.
John _______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
------------------------------
Message: 7 Date: Fri, 14 Oct 2011 05:06:44 -0400 From: DZ-Jay dz@caribe.net To: TextMate users textmate@lists.macromates.com Subject: [TxMt] Re: problem with Lion's new hidden scroll bars Message-ID: 7B5F91DF-B98E-429D-A2F1-A839B2E188AF@caribe.net Content-Type: text/plain; charset=us-ascii
Hello, I see in that FAQ that the scroll-bars visibility issue is indeed a "frequently asked question," but it doesn't appear to be even a "singularly answered question."
Is there a work-around?
By the way, thanks for the link. TextMate not re-opening its windows on restarting was driving me crazy!
dZ.
On Jul 21, 2011, at 08:25, Luc Heinrich wrote:
On 21 juil. 2011, at 14:05, Max Lein wrote:
I've upgraded to Lion yesterday and I've configured TextMate to use a dark background. Lion's new hidden scroll bars are now unusable, I cannot see them when scrolling.
http://wiki.macromates.com/Troubleshooting/Lion
-- Luc Heinrich - luc@honk-honk.com
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
------------------------------
_______________________________________________ textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
End of textmate Digest, Vol 41, Issue 11 ****************************************
On 14 Oct 2011, at 18:51, John Relosa wrote:
After playing around with it it only works if there is nothing before it. When I start a line with then I have 2 different colors one for % and one for the name of the array. But the moment I put even a space before the %array or declare it or it's inside a parenthesis of a function then it does not work it gets a generic color...
match = '^(%)([a-zA-Z0-9_]\w*)';
This pattern specifically anchors at “begin of line” — that’s the ‘^’ character.
Full documentation for the regular expression syntax is at http://manual.macromates.com/en/regular_expressions#syntax_oniguruma — though there are also lots of online guides which should apply to TextMate’s syntax as well.