Golang代码高亮适用MT管理器

推荐应用于夜间模式 -> ️️好看又护眼

{
    name: ["Go", ".go", ".ʕϖʔ"],
    colors: [
        "preprocessor" > "tagName",
        "operator" > "variable",
        "function" > "default",
        "keyword" > "keyword",
        "identifier" > "keyword2",
        "string" > "string",
        "number" > "label",
        "comment" > "comment",
        // "background", #201e8ae8, #1d7da0c9,
    ],
    // 吐槽一下,拉夸背景线,居然不能联用(就是一次性匹配到多个结果的话没法用,不会生效)
    // lineBackground: {match: /[.]/ + /{3}/, color: "background"},
    comment: {startsWith: "//"},
    comment: {startsWith: "/*", endsWith: "*/"},
    contains: [
        {builtin: #QUOTED_STRING#},
        {builtin: #PROGRAM_NUMBER#},
        {match: /\`.*\`/, 0: "string"},
        {match: /\`([^`]*)\`/, 0: "string"},
        {match: /(?m)^[ \t]*(import)(\s*<.*?>)/, 1: "preprocessor", 2: "string"},
        {match: /(?m)^[ \t]*package/, 0: "preprocessor"},
        {match: keywordsToRegex(
            "break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var"
        ), 0: "keyword"},
        {match: keywordsToRegex(
            "append bool byte cap close complex complex64 complex128 uint16 copy false float32 float64 imag int int8 int16 uint32 int32 int64 iota len make new nil panic uint64 print println real recover string true uint uint8 uintptr"
        ), 0: "identifier"},
        {match: keywordsToRegex(
            "+ - * / % ++ -- == != > < >= <= && || ! & | ^ << >> = += -= *= /= %= <<= >>= &= ^= |= , . ... : ;"
        ), 0: "variable"}
    ]
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容