Sublimetext2 .tmLanguage—如何包含/排除变量

Sublimetext2 .tmLanguage—如何包含/排除变量,sublimetext2,tmlanguage,Sublimetext2,Tmlanguage,我正在寻找包含/排除.tmLanguage文件中定义的两个变量的示例 示例1——突出显示整个enchilada,包括两个变量: {\code_one*[variable_one]{variable_two}} {\code_two*[variable_three]{variable_four}} 示例2——突出显示整个enchilada,少一个或两个变量: {\code_one*[variable_one]{variable_two}} {\code_two*[variable_three

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

示例1——突出显示整个enchilada,包括两个变量:

{\code_one*[variable_one]{variable_two}}
{\code_two*[variable_three]{variable_four}}
示例2——突出显示整个enchilada,少一个或两个变量:

{\code_one*[variable_one]{variable_two}}
{\code_two*[variable_three]{variable_four}}

包括变量文本——例如,
\hspace*{3.45in}
<代码>\begin{singlespace*}<代码>\end{document}

.TM语言

<!-- 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 -->
.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 -->

比赛
(?=\s)(?=\[\w@]\[\w@]{2}\\[\w@]{3}\\[\w@]{4}\[\w@]{5}\\[\w@]{6})s
名称
meta.space-after-command.latex
开始
(\{\\bf)(?:\\uline |代码二|代码三))(?:(\[)([^\]]*)(\]))?(\{)
开始接受
1.
名称
lawlist.base.latex
2.
名称
lawlist.prefix.latex
3.
名称
lawlist.open_square_括号
4.
名称
lawlist.first_variable.latex
5.
名称
lawlist.close\u square\u括号
6.
名称
lawlist.open_wave_括号.latex
内容名
lawlist.second_variable.latex
结束
\}\}
尾声
0
名称
法律列表\u关闭\u波浪形\u括号
名称
lawlist.whole_enchilada.latex
模式
包括
$self
*.主题

<!-- 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 -->

名称
粗体/下划线
范围
lawlist.base.latex | lawlist.open | square |括号.latex | lawlist.first |变量.latex | lawlist.close | square |括号.latex | lawlist.pen | wavy |括号.latex | lawlist
设置
方式
前景
#E3

我知道你可以想出一个更好的标题。谢谢——标题被修改为不太像代码。那么你试过什么?我发现最好的学习方法是浏览其他.tmLanguage文件,看看它们是如何做到的,同时为你可能遇到的任何问题保留一个关于正则表达式的良好参考。作用域的全部要点是突出显示文本的特定部分,所以您所要做的就是在开始和结束之间添加一个排除语句。。。