Sublime Forum

Syntax specific highlighting with Sublime Text 2

#1

I’m wondering if there is a way to have two different tag colours (“colors” for those in the US) for different language tags in the same file.

For example, lets say I have ColdFusion code and HTML code in the same .cfm file. Could I make the ColdFusion tags red and the HTML tags Blue?

For instance, lets call the below file HelloWorld.cfm - could I colour the tags differently?

[code]

This is my title
#myvar#
[/code]

NOTE: I also posted this question on Stack Overflow: http://stackoverflow.com/questions/9345222/syntax-specific-highlighting-with-sublime-text-2

Thanks!

0 Likes

#2

Yes, this is possible through includes in the language definition. Have a look here: manual.macromates.com/en/languag … #rule_keys

0 Likes

#3

What you need to do is add to your tmTheme file color rules for

punctuation.definition.tag.begin.cfml
entity.name.tag.cf
punctuation.definition.tag.end.cfml

Im not sure if all tags are defined. What I’ll try to do is match any tag that starts with “cf” as entity.name.tag.cf.
You’ll get some initially but when I update entity.name.tag.cf should color all cf tags.

HTH

Edit: grammar

0 Likes

#4

Thanks atomi - I’ll give that a shot! :smile:

0 Likes