是否可以更改Sublime Text 3中某些代码的背景颜色?

时间:2018-01-22 03:59:42

标签: sublimetext3

我希望更改来电__$sa__logingtag的背景颜色,这样我就可以快速找到所有的分析结果。代码在.js文件中。

this.__$sa__login(user.id)._____
....
gtag( { 'Country': user.zoneId } )

这样的事情: enter image description here

1 个答案:

答案 0 :(得分:0)

我找到了这个出色的Sublime Text插件HighlightWords

的解决方案

enter image description here

这是我的配置:

{
  // The colors to highlight texts are specified by a list of theme scope names,
  // and HighlightWords uses this list in circular order.
  "colors_by_scope": [
    "string",
    "entity.name.class",
    "variable.parameter",
    "invalid.deprecated",
    "invalid",
    "support.function"
  ],
  "whole_word": false,
  "use_regex": true,
  "ignore_case": false,

  // Keywords to be always highlighted, clear the list to disable it.
  // "keyword" are literally matched, and "color" refers to theme scope names.
  // "flag": 0 - regex, 1 - literal (default), 2 - regex and ignore case, 3 - literal and ignore case
  // Note that json has some special characters like '\' should be escaped.
  "permanent_highlight_keyword_color_mappings": [
    {"keyword": "TODO", "color": "support.function"},
    {"keyword": "FIXIT .*", "color": "support.function", "flag": 2},
    {
      "flag": 0,
      "keyword": "this\\.__\\$sa__\\w+\\(.*?\\)\\._+",
      "color": "text.html.vue source.js.embedded.html meta.export.js meta.object-literal.js meta.object-literal.js meta.block.js meta.function-call.method.js meta.group.js string.quoted.single.js"
    },
    {
      "flag": 0,
      "keyword": "gtag\\(.*?\\)",
      "color": "text.html.vue source.js.embedded.html meta.export.js meta.object-literal.js meta.object-literal.js meta.block.js meta.function-call.method.js meta.group.js string.quoted.single.js"
    }
  ]

}