Thursday, 5 February 2015

adding syntax coloring to sublime for specific text or patterns



I have an XML-like markup that I need to augment the existing coloring to include new text to color such as <SCHEDULE> or // ==== * ===== where `* is some text.


I opened then XML.tmLanguage file which is where I assume this needs to happen, but not clear what to use for the <key> in the <dict> file:



<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(&lt;\?)\s*([-_a-zA-Z0-9]+)</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.xml</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.xml</string>
</dict>
</dict>
<key>end</key>
<string>(\?&gt;)</string>
<key>name</key>
<string>meta.tag.preprocessor.xml</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string> ([a-zA-Z-]+)</string>
<key>name</key>
<string>entity.other.attribute-name.xml</string>
</dict>
<dict>
<key>include</key>
<string>#doublequotedString</string>
</dict>
<dict>
<key>include</key>
<string>#singlequotedString</string>
</dict>
</array>
</dict>
<dict>


Question: How do I actually add XML to this file to provide custom coloring for specific words and for matches. I started with the following:


name \


... but still not clear how to define the scope/color.


I am using Neon color scheme from @Mattdmo because it should have the most scopes.


No comments:

Post a Comment