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

 

效果如下:

 

 

解決問題五大法寶

  1. 谷歌
  2. 百度
  3. 官方文檔
  4. 官方論壇
  5. stackOverflow


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM