.tmLanguage - 如何包含/排除变量

时间:2013-04-08 22:40:51

标签: sublimetext2 tmlanguage

我正在寻找包含/排除.tmLanguage文件中定义的几个变量的示例。

示例1 - 突出显示整个辣酱玉米饼馅,包括两个变量:

{\code_one*[variable_one]{variable_two}}

示例2 - 突出显示整个辣酱玉米饼馅,减少其中一个或两个变量:

{\code_two*[variable_three]{variable_four}}

1 个答案:

答案 0 :(得分:0)

include_variable_text - 例如\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 - 此代码包含额外的三(3)个密钥以供将来使用 - 例如[anything]

<!-- BEGIN exclude_text -->
<dict>
    <key>match</key>
    <string>(?=\s)(?&lt;=\\[\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 -->