Jai*_*nez 1 color-scheme themes sublimetext3
在.tmTheme文件中:
<dict>
<key>name</key>
<string>Entity name</string>
<key>scope</key>
<string>entity.name - (entity.name.filename | entity.name.section | entity.name.tag | entity.name.label)</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#A6E22E</string>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud)
下一个范围字符串:
<string>entity.name - (entity.name.filename | entity.name.section | entity.name.tag | entity.name.label)</string>
Run Code Online (Sandbox Code Playgroud)
是一种正则表达吗?什么适用于这个定义?在同一个文件的另一部分,我可以看到这样的事情:
<string>variable.parameter - (source.c | source.c++ | source.objc | source.objc++)</string>
Run Code Online (Sandbox Code Playgroud)
这不是一个正则表达; 它是从TextMate借来的范围选择器.
可以对范围选择器进行AND,OR和减法,例如:
(a | b) & c - d选择与d不匹配的范围,并与c,a或b匹配.
在Sublime Text中,您可以通过Tools菜单 - > Developer- > 找到光标右侧的字符范围Show Scope Name.
对于测试选择器,您可以使用Sublime Text控制台中的view.match_selector或view.find_by_selector API(View菜单 - > Show Console).
查看第一个游标的范围是否与第一个示例中的选择器匹配的示例:
view.match_selector(view.sel()[0].begin(), 'entity.name - (entity.name.filename | entity.name.section | entity.name.tag | entity.name.label)')
Run Code Online (Sandbox Code Playgroud)
可以使用以下运算符:
-:没有,在范围内的任何地方(要清楚,这是一个由空格包围的短划线,因为短划线可以出现在范围名称的中间)&:with,范围内的任何位置(在.tmTheme文件中,XML,&应该转义为&,除非在CDATA节点内.) (space): with, must come after (i.e. to the right of) the preceding scope|和,:或者,范围内的任何地方(... )可用于将选择器组合在一起.),因此永远不会发生与运算符的冲突.string | comment相同string|comment.source.python使用.python或*.python等.|,它本身就会失败|source.source|然而,工作.-而source -将失败.在以下Python代码段中,使用语法测试格式,所有测试都将通过,因此它可以作为选择器如何工作的演示:
a = "hello world" # comment
# ^^^^^^^^^^^^^ string.quoted.double
# ^^^^^^^^^^^^^ string
# ^^^^^^^^^^^^^ string.quoted
# ^^^^^^^^^^^^^ string.quoted.
# ^^^^^^^^^^^^^ - quoted.double
# ^^^^^^^^^^^^^ string - comment
# ^^^^^^^^^^^^^ string, comment
# ^^^^^^^^^^^^^ string | comment
# ^^^^^^^^^^^^^ string & - comment
# ^^^^^^^^^^^^^ string & - comment
# ^^^^^^^^^^^^^ source string
# ^^^^^^^^^^^^^ source & (string - comment)
# ^^^^^^^^^^^^^ source - (string & comment)
# ^^^^^^^^^^^^^ string & source
# ^ source.python string.quoted.double.block.python punctuation.definition.string.begin.python
# ^ source & string & punctuation.definition.string.begin.python
# ^ string & punctuation & source
# ^ string punctuation & source
# ^ source punctuation & string
# ^ source string punctuation - (punctuation string)
# ^ string - source comment - punctuation source
# ^ string - source comment - comment
# ^ source - python
# ^ source - (source & python)
# ^ source - (source python)
# ^ source.python - source.python.string
# ^ source.python.. ..string..
# ^ comment - string
# ^ comment
# ^ comment, string
# ^^^^^^^^^^^^^^^^^^^ comment, string | source
# ^ (punctuation | string) & source.python - comment
# ^ (punctuation & string) & source.python - comment
Run Code Online (Sandbox Code Playgroud)
请注意,由于范围选择器特性似乎忽略了一些更高级的构造,您可能会发现.tmTheme使用范围选择器创建的规则适用于或不适用于您可能不期望的情况.
| 归档时间: |
|
| 查看次数: |
450 次 |
| 最近记录: |