Sublime Text3括号配对与代码包围效果BracketHighlighter
就这么看json等配置文件,太难了,我们需要括号匹配插件BracketHighlighter,但是装完以后只有下划线提示不明显,需要配置
Bracket Settings-Default 文件不能修改,只能修改Bracket Settings-User,复制以下设置:
"bracket_styles": {
// "default" and "unmatched" styles are special
// styles. If they are not defined here,
// they will be generated internally with
// internal defaults.
// "default" style defines attributes that
// will be used for any style that does not
// explicitly define that attribute. So if
// a style does not define a color, it will
// use the color from the "default" style.
"default": {
"icon": "dot",
// BH1's original default color for reference
//"color": "entity.name.class",
"color": "brackethighlighter.default",
"style": "highlight"
},
// This particular style is used to highlight
// unmatched bracket pairs. It is a special
// style.
"unmatched": {
"icon": "question",
"color": "brackethighlighter.unmatched",
"style": "highlight"
},
"curly": {
"icon": "curly_bracket",
"color": "brackethighlighter.curly",
"style": "highlight"
},
"round": {
"icon": "round_bracket",
"color": "brackethighlighter.round",
"style": "highlight"
},
"square": {
"icon": "square_bracket",
"color": "brackethighlighter.square",
"style": "highlight"
},
"angle": {
"icon": "angle_bracket",
"color": "brackethighlighter.angle",
"style": "highlight"
},
"tag": {
"icon": "tag",
"color": "brackethighlighter.tag",
"style": "highlight"
},
"c_define": {
"icon": "hash",
"color": "brackethighlighter.c_define",
"style": "highlight"
},
"single_quote": {
"icon": "single_quote",
"color": "brackethighlighter.quote",
"style": "highlight"
},
"double_quote": {
"icon": "double_quote",
"color": "brackethighlighter.quote",
"style": "highlight"
},
"regex": {
"icon": "regex",
"color": "brackethighlighter.quote",
"style": "highlight"
}
}
设置好了以后,就是白色的高亮提示,并不好看,并不直观,我要设置的是代码包围效果
就像这样的效果
设置
"high_visibility_enabled_by_default": true,
"high_visibility_style": "outline"
但是这样的框框是白色的不是蓝色的,要设置成蓝色的,看官方文档
https://facelessuser.github.io/BracketHighlighter/customize/#configuring-highlight-style
high_visibility_color
Modifies the high visibility color. There are three types of settings you can use:
- __default__ is a special reserved value which will use the color set in bracket_styles. SeeConfiguring Highlight Style for more info.
- __bracket__ is a special reserved value which will inherit the defined color of the highlighted bracket.
- Any valid scope found in your color scheme.
// Color for high visibility mode
"high_visibility_color": "__bracket__",
There are two special style definitions whose names are reserved: default and unmatched, but you can configure them.
Add this to your color scheme:
<dict>
<key>name</key>
<string>Bracket Curly</string>
<key>scope</key>
<string>brackethighlighter.curly</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CC99CC</string>
</dict>
</dict>
And then use the scope:
"curly": {
"icon": "curly_bracket"
"color": "brackethighlighter.curly",
// "style": "underline"
},
所以如果把"high_visibility_color": "__default__",设为default ,它就会用
我在color scheme里brackethighlighter.default定义的值
<dict>
<key>name</key>
<string>Bracket Default</string>
<key>scope</key>
<string>brackethighlighter.default</string>
用这个值
但是我怎么能打开传说中的color scheme . tmTheme 文件?搜索也搜不到只有.tmTheme.cache文件,ST3里的文件都被压缩了起来,可以直接从压缩包运行,想要看可以安装 PackageResourceViewer 插件
网页 https://github.com/skuroda/PackageResourceViewer
装好以后,open-resource
找到color Scheme-Default
找到自己的Theme
在</ array >上面加上
<dict>
<key>name</key>
<string>Bracket Default</string>
<key>scope</key>
<string>brackethighlighter.default</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6495ED</string>
</dict>
</dict>
就有了蓝色代码包围效果
更多颜色设置见
http://www.tuicool.com/articles/EV3eEzA
效果如下:
解决问题五大法宝
- 谷歌
- 百度
- 官方文档
- 官方论坛
- stackOverflow