sublimetext2 - Syntax Highlighting in Sublime Text 2 -
so have been trying figure out how add syntax highlighting name of typedef's in c++ files, in sublime text.
for example, if have typedef long long integer; want integer highlighted (preferably same color other types: int, bool, etc.). went looked @ c.tmlanuage file, , tried add following regex code ^typedef.*?\s(\w+)\s*; storage.type.c (line 49), didn't work. if add word string, highlight instances of word string. tried going in c++.tmlanguage file, , adding regex code storage.type.c++, still did not work.
does know how typedef's highlighted in sublime text?
also, there way syntax highlighting class name? let's declare string or vector, either string or vector highlighted.
that regex work (i believe) if had along lines of typedef foo; behavior want, have create more complex pattern entry in tmlanguage file. language file based on textmates, want have reference (http://manual.macromates.com/en/language_grammars#language_grammars). recommend using plistjsonconverter (working in json easier me working in xml). need define begin , end patterns (begin typedef end ;). can apply whatever patterns want group.
as class name highlighting, see what, if scopes being applied. if none are, have come regex apply scope those. can add color entry, or use defined 1 color scheme.
edit:
actually don't appear json. see () rather []. json pretty simple understand. can more in depth, wikipedia place start. interested in things under "rule keys" section. did searching (because knew there better examples out there), , came across http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html . goes on syntax definitions scratch, relevant section http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html#analyzing-patterns. don't have regex find class names, have come 1 yourself. if haven't though, may want search around see if else has implemented language file in way works you.
you want start built in tmlanguage file , convert plist json. can edit file , move back.
Comments
Post a Comment