I'm trying (for the first time ever) to make Textmate do syntax- highlighting. The files I want to highlight are JUNOS router configuration files. My beginning grammar is
{ scopeName = 'source.junos'; fileTypes = ( 'junos' ); foldingStartMarker = '{\s*$'; foldingStopMarker = '^\s*}'; patterns = ( { name = 'keyword.other.junos'; match = 'groups|system|chassis|interfaces|forwarding-options|snmp| routing-options|protocols|policy-options|firewall|routing-instances'; }, { name = 'comment.block.junos'; match = '/*[^*]**/'; }, ); }
When I set the language to JUNOS, folding works but the keywords or comments stay the default color. Do I need to do something else to see color highlighting? (assume nothing is too dumb - I'm a newbie to this)
Assuming I get this working, is there a repository of grammars where I can share it? And maybe find grammars for other odd languages?
-- Pete
On 7/16/07 5:20 PM, Pete Siemsen wrote:
I'm trying (for the first time ever) to make Textmate do syntax-highlighting.� The files I want to highlight are JUNOS router configuration files.� My beginning grammar is
{ scopeName = 'source.junos'; fileTypes = ( 'junos' ); foldingStartMarker = '{\s*$'; foldingStopMarker = '^\s*}'; patterns = ( { name = 'keyword.other.junos'; match = 'groups|system|chassis|interfaces|forwarding-options|snmp|routing-options|protocols|policy-options|firewall|routing-instances'; }, { name = 'comment.block.junos'; match = '/*[^*]**/'; }, ); }
When I set the language to JUNOS, folding works but the keywords or comments stay the default color.� Do I need to do something else to see color highlighting?� (assume nothing is too dumb - I'm a newbie to this)
Assuming I get this working, is there a repository of grammars where I can share it?� And maybe find grammars for other odd languages?
Yes, you'll have to specify a different color in your current style for keyword.other.junos and comment.block.junos.
Thanks, but how do I do that? Textmate->Preferences->Fonts and Colors lets me set a color for "keyword", but doing so has no effect on the display of my JUNOS text.
-- Pete
On Jul 16, 2007, at 6:55 PM, Dana Kashubeck wrote:
On 7/16/07 5:20 PM, Pete Siemsen wrote:
I'm trying (for the first time ever) to make Textmate do syntax- highlighting.� The files I want to highlight are JUNOS router configuration files.� My beginning grammar is { scopeName = 'source.junos'; fileTypes = ( 'junos' ); foldingStartMarker = '{\s*$'; foldingStopMarker = '^\s*}'; patterns = ( { name = 'keyword.other.junos'; match = 'groups|system|chassis|interfaces|forwarding-options|snmp| routing-options|protocols|policy-options|firewall|routing-instances'; }, { name = 'comment.block.junos'; match = '/*[^*]**/'; }, ); } When I set the language to JUNOS, folding works but the keywords or comments stay the default color.� Do I need to do something else to see color highlighting?� (assume nothing is too dumb - I'm a newbie to this) Assuming I get this working, is there a repository of grammars where I can share it?� And maybe find grammars for other odd languages?
Yes, you'll have to specify a different color in your current style for keyword.other.junos and comment.block.junos.
--
Dana Kashubeck Systems Manager Riemer Reporting Service Inc. http://www.riemer.com
Phone: 440-835-2477 x. 125 Fax: 440-835-4594
<dana.kashubeck.vcf>
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 7/16/07 9:16 PM, Pete Siemsen wrote:
Thanks, but how do I do that? Textmate->Preferences->Fonts and Colors lets me set a color for "keyword", but doing so has no effect on the display of my JUNOS text.
On the Fonts & Colors panel, click the '+' button to add a new definition. In the Scope Selector field type 'keyword.other.junos'. Now, you'll see a new line in the table. Type a name in the 'Element' column. Click on the FG and BG color wells and choose a color. You can also set bold, italic, and underline.
Lather, rinse, repeat for comment.block.junos.
You may want to save a copy of the color scheme before you mess with it. From the drop-down at the top of the panel, choose "Edit theme list...", highlight the theme you want, click on the double-plus button and hit the 'Okay' button.
Enjoy your pretty colors!
Thanks, that did the trick.
-- Pete
On Jul 16, 2007, at 7:23 PM, Dana Kashubeck wrote:
On 7/16/07 9:16 PM, Pete Siemsen wrote:
Thanks, but how do I do that? Textmate->Preferences->Fonts and Colors lets me set a color for "keyword", but doing so has no effect on the display of my JUNOS text.
On the Fonts & Colors panel, click the '+' button to add a new definition. In the Scope Selector field type 'keyword.other.junos'. Now, you'll see a new line in the table. Type a name in the 'Element' column. Click on the FG and BG color wells and choose a color. You can also set bold, italic, and underline.
Lather, rinse, repeat for comment.block.junos.
You may want to save a copy of the color scheme before you mess with it. From the drop-down at the top of the panel, choose "Edit theme list...", highlight the theme you want, click on the double-plus button and hit the 'Okay' button.
Enjoy your pretty colors!
--
Dana Kashubeck Systems Manager Riemer Reporting Service Inc. http://www.riemer.com
Phone: 440-835-2477 x. 125 Fax: 440-835-4594
<dana.kashubeck.vcf>
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 16. Jul 2007, at 23:20, Pete Siemsen wrote:
I'm trying (for the first time ever) to make Textmate do syntax- highlighting. The files I want to highlight are JUNOS router configuration files. My beginning grammar is [...] When I set the language to JUNOS, folding works but the keywords or comments stay the default color. Do I need to do something else to see color highlighting? (assume nothing is too dumb - I'm a newbie to this)
To see if your grammar is actually matching press ⌃⇧P on the elements it should match, then you’ll see the scope assigned to this part of the document.
The keyword rule looks correct, but the comment rule will only work for block comments on a single line. To make it span multiple lines instead use begin/end like this:
{ name = 'comment.block.junos'; begin = '/*'; end = '*/'; },
As for coloring, they should inherit the styles already setup for comment and keyword (if matched correctly).
Assuming I get this working, is there a repository of grammars where I can share it? And maybe find grammars for other odd languages?
There’s a huge repository of existing bundles: <http:// macromates.com/svn/Bundles/trunk/Bundles/>