sublimetext2 - .tmLanguage -- how to include / exclude a variable -
i looking examples include / exclude couple of variables defined within .tmlanguage file.
example 1 -- highlight whole enchilada, including both variables:
{\code_one*[variable_one]{variable_two}}
example 2 -- highlight whole enchilada, less either or both variables:
{\code_two*[variable_three]{variable_four}}
include_variable_text -- e.g., \hspace*{3.45in}
; \begin{singlespace*}
; \end{document}
.
.tmlanguage
<!-- begin include_variable_text --> <dict> <key>begin</key> <string>\\makebox\[|\\hspace\*\{|\\begin\{|\\end\{</string> <key>begincaptures</key> <dict> <key>0</key> <dict> <key>name</key> <string>lawlist.include_variable_text.begin.latex</string> </dict> </dict> <key>end</key> <string>\}|\]</string> <key>endcaptures</key> <dict> <key>0</key> <dict> <key>name</key> <string>lawlist.include_variable_text.end.latex</string> </dict> </dict> <key>name</key> <string>lawlist.include_variable_text.latex</string> <key>patterns</key> <array> <dict> <key>include</key> <string>$base</string> </dict> </array> </dict> <!-- end -->
tm.theme
<!-- begin lawlist.include_variable_text --> <dict> <key>name</key> <string>grayed-out</string> <key>scope</key> <string>lawlist.include_variable_text.latex</string> <key>settings</key> <dict> <key>fontstyle</key> <string>italic</string> <key>foreground</key> <string>#e3e3e3</string> <key>background</key> <string>#ffffff</string> </dict> </dict> <!-- end -->
exclude_variable_text
{\bf\uline{excluded_variable_text}}
.tmlanguage -- code contains 3 (3) keys future use -- e.g., [anything]
<!-- begin exclude_text --> <dict> <key>match</key> <string>(?=\s)(?<=\\[\w@]|\\[\w@]{2}|\\[\w@]{3}|\\[\w@]{4}|\\[\w@]{5}|\\[\w@]{6})\s</string> <key>name</key> <string>meta.space-after-command.latex</string> </dict> <dict> <key>begin</key> <string>((\{\\bf)(?:\\uline|code_two|code_three))(?:(\[)([^\]]*)(\]))?(\{)</string> <key>begincaptures</key> <dict> <key>1</key> <dict> <key>name</key> <string>lawlist.base.latex</string> </dict> <key>2</key> <dict> <key>name</key> <string>lawlist.prefix.latex</string> </dict> <key>3</key> <dict> <key>name</key> <string>lawlist.open_square_bracket.latex</string> </dict> <key>4</key> <dict> <key>name</key> <string>lawlist.first_variable.latex</string> </dict> <key>5</key> <dict> <key>name</key> <string>lawlist.close_square_bracket.latex</string> </dict> <key>6</key> <dict> <key>name</key> <string>lawlist.open_wavy_bracket.latex</string> </dict> </dict> <key>contentname</key> <string>lawlist.second_variable.latex</string> <key>end</key> <string>\}\}</string> <key>endcaptures</key> <dict> <key>0</key> <dict> <key>name</key> <string>lawlist_close_wavy_bracket.latex</string> </dict> </dict> <key>name</key> <string>lawlist.whole_enchilada.latex</string> <key>patterns</key> <array> <dict> <key>include</key> <string>$self</string> </dict> </array> </dict> <!-- end exclude_text -->
*.tmtheme
<!-- begin strong blue #0000ff -- uline exclude_text --> <dict> <key>name</key> <string>bold / underline</string> <key>scope</key> <string>lawlist.base.latex|lawlist.open_square_bracket.latex|lawlist.first_variable.latex|lawlist.close_square_bracket.latex|lawlist.pen_wavy_bracket.latex|lawlist_close_wavy_bracket.latex</string> <key>settings</key> <dict> <key>fontstyle</key> <string></string> <key>foreground</key> <string>#e3e3e3</string> </dict> </dict> <!-- end -->
Comments
Post a Comment