In case of further .tmLanguage
-related emergencies, take note of the TextMate Manual's Language Grammars section. Their examples are in JSON: a format infinitely more readable than PLIST but not a thing that Sublime Text can properly utilize. ST2 and ST3 users can use PackageDev to edit grammars in YAML.
As you've mentioned, and as confirmed by my regex search &(g|l)t;
, there are way too many <
or >
tag delimiters within the Sublime Text 2 (build 2221) HTML.tmLanguage
grammar file. Some HTML tags and wacky regex tag contexts are so special that they warrant a unique denotation, which unfortunately for us includes re-specifying the scope and context of the tag delimiters, <
and >
, rather than hooking in to some universal inequality symbol scope selector.
Luckily, every instance of <
and >
is given a scope name of punctuation.definition.tag.???.html
, where ???
could be begin
, end
, or nothing. Likewise, each HTML tag (html
in <html>
) is named quite a lot like entity.name.tag.html
. Fortune be praised, it's time for regular expressions!
In your HTML.tmLanguage
file – I'd actually suggest cloning a new one into Packages/User
for safety's sake, although you'll have to rename the file and the grammar – perform a regex search for all offending scope names with:
punctuation\.definition\.tag.*(?=</string>)
…and replace every result (this should be as simple as one Ctrl+V
) with the same name as the tags themselves, entity.name.tag.html
. In my testing I also added another sub-scope past tag
in case I needed to find the replacements later, so it looked like this:
entity.name.tag.delimiter.html
I've tested this with ST2's default color schemes, and it should work with other well-written themes. Here it is with Dayle Rees' Frontier:
It even works in Sublime Text 3!