I am looking for examples to include / exclude a couple of variables as defined within a .tmLanguage
file.
Example 1 -- highlight the whole enchilada, including both variables:
{\code_one*[variable_one]{variable_two}}
Example 2 -- highlight the 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 -- This code contains an extra three (3) keys for 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 -->