From 9e940a11935b61da2fc2a170adca7b67eebcdc45 Mon Sep 17 00:00:00 2001 From: tiagovla Date: Fri, 21 Oct 2022 03:08:58 -0300 Subject: [PATCH] fix: invalid character in group name 0.7 neovim version (#18) --- lua/tokyodark/highlights.lua | 197 ++++++++++++++++++----------------- lua/tokyodark/utils.lua | 15 +++ 2 files changed, 116 insertions(+), 96 deletions(-) diff --git a/lua/tokyodark/highlights.lua b/lua/tokyodark/highlights.lua index d231151..7874f58 100644 --- a/lua/tokyodark/highlights.lua +++ b/lua/tokyodark/highlights.lua @@ -198,104 +198,109 @@ hl.plugins.treesitter = { commentTSDanger = hl.predef.RedItalic, commentTSNote = hl.predef.BlueItalic, commentTSWarning = hl.predef.YellowItalic, - ["@comment"] = { link = "Comment" }, - ["@error"] = { link = "Error" }, - ["@none"] = { bg = "NONE", fg = "NONE" }, - ["@preproc"] = { link = "PreProc" }, - ["@define"] = { link = "Define" }, - ["@operator"] = { link = "Operator" }, - ["@punctuation.delimiter"] = { link = "Delimiter" }, - ["@punctuation.bracket"] = { link = "Delimiter" }, - ["@punctuation.special"] = { link = "Delimiter" }, - ["@string"] = { link = "String" }, - ["@string.regex"] = { link = "String" }, - ["@string.escape"] = { link = "SpecialChar" }, - ["@string.special"] = { link = "SpecialChar" }, - ["@character"] = { link = "Character" }, - ["@character.special"] = { link = "SpecialChar" }, - ["@boolean"] = { link = "Boolean" }, - ["@number"] = { link = "Number" }, - ["@float"] = { link = "Float" }, - ["@function"] = { link = "Function" }, - ["@function.call"] = { link = "Function" }, - ["@function.builtin"] = { link = "Special" }, - ["@function.macro"] = { link = "Macro" }, - ["@method"] = { link = "Function" }, - ["@method.call"] = { link = "Function" }, - ["@constructor"] = { link = "Special" }, - ["@parameter"] = { link = "Identifier" }, - ["@keyword"] = { link = "Keyword" }, - ["@keyword.function"] = { link = "Keyword" }, - ["@keyword.operator"] = { link = "Keyword" }, - ["@keyword.return"] = { link = "Keyword" }, - ["@conditional"] = { link = "Conditional" }, - ["@repeat"] = { link = "Repeat" }, - ["@debug"] = { link = "Debug" }, - ["@label"] = { link = "Label" }, - ["@include"] = { link = "Include" }, - ["@exception"] = { link = "Exception" }, - ["@type"] = { link = "Type" }, - ["@type.builtin"] = { link = "Type" }, - ["@type.qualifier"] = { link = "Type" }, - ["@type.definition"] = { link = "Typedef" }, - ["@storageclass"] = { link = "StorageClass" }, - ["@attribute"] = { link = "PreProc" }, - ["@field"] = { link = "Identifier" }, - ["@property"] = { link = "Function" }, - ["@variable"] = { link = "Normal" }, - ["@variable.builtin"] = { link = "Special" }, - ["@constant"] = { link = "Constant" }, - ["@constant.builtin"] = { link = "Special" }, - ["@constant.macro"] = { link = "Define" }, - ["@namespace"] = { link = "Include" }, - ["@symbol"] = { link = "Identifier" }, - ["@text"] = { link = "Normal" }, - ["@text.strong"] = { bold = true }, - ["@text.emphasis"] = { italic = true }, - ["@text.underline"] = { underline = true }, - ["@text.strike"] = { strikethrough = true }, - ["@text.title"] = { link = "Title" }, - ["@text.literal"] = { link = "String" }, - ["@text.uri"] = { link = "Underlined" }, - ["@text.math"] = { link = "Special" }, - ["@text.environment"] = { link = "Macro" }, - ["@text.environment.name"] = { link = "Type" }, - ["@text.reference"] = { link = "Constant" }, - ["@text.todo"] = { link = "Todo" }, - ["@text.note"] = hl.predef.BlueItalic, - ["@text.warning"] = hl.predef.YellowItalic, - ["@text.danger"] = hl.predef.RedItalic, - ["@tag"] = { link = "Tag" }, - ["@tag.attribute"] = { link = "Identifier" }, - ["@tag.delimiter"] = { link = "Delimiter" }, } -hl.plugins.cmp = { - LspNamespace = { link = "@namespace" }, - LspType = { link = "@type" }, - LspClass = { link = "@type" }, - LspEnum = { link = "@constant" }, - LspInterface = { link = "@constant" }, - LspStruct = { link = "@constant" }, - LspTypeParameter = { link = "@type" }, - LspParameter = { link = "@parameter" }, - LspVariable = { link = "@variable" }, - LspProperty = { link = "@property" }, - LspEnumMember = { link = "@constant" }, - LspEvent = { link = "@constant" }, - LspFunction = { link = "@function" }, - LspMethod = { link = "@method" }, - LspMacro = { link = "@constant.macro" }, - LspKeyword = { link = "@keyword" }, - LspModifier = { link = "TSModifier" }, - LspComment = { link = "@comment" }, - LspString = { link = "@string" }, - LspNumber = { link = "@number" }, - LspRegexp = { link = "@string.regex" }, - LspOperator = { link = "@operator" }, - LspDecorator = { link = "@symbol" }, - LspDeprecated = { link = "@text.strike" }, -} +if u.check_min_version(0, 8, 0) then + hl.plugins.treesitter = { + ["@comment"] = { link = "Comment" }, + ["@error"] = { link = "Error" }, + ["@none"] = { bg = "NONE", fg = "NONE" }, + ["@preproc"] = { link = "PreProc" }, + ["@define"] = { link = "Define" }, + ["@operator"] = { link = "Operator" }, + ["@punctuation.delimiter"] = { link = "Delimiter" }, + ["@punctuation.bracket"] = { link = "Delimiter" }, + ["@punctuation.special"] = { link = "Delimiter" }, + ["@string"] = { link = "String" }, + ["@string.regex"] = { link = "String" }, + ["@string.escape"] = { link = "SpecialChar" }, + ["@string.special"] = { link = "SpecialChar" }, + ["@character"] = { link = "Character" }, + ["@character.special"] = { link = "SpecialChar" }, + ["@boolean"] = { link = "Boolean" }, + ["@number"] = { link = "Number" }, + ["@float"] = { link = "Float" }, + ["@function"] = { link = "Function" }, + ["@function.call"] = { link = "Function" }, + ["@function.builtin"] = { link = "Special" }, + ["@function.macro"] = { link = "Macro" }, + ["@method"] = { link = "Function" }, + ["@method.call"] = { link = "Function" }, + ["@constructor"] = { link = "Special" }, + ["@parameter"] = { link = "Identifier" }, + ["@keyword"] = { link = "Keyword" }, + ["@keyword.function"] = { link = "Keyword" }, + ["@keyword.operator"] = { link = "Keyword" }, + ["@keyword.return"] = { link = "Keyword" }, + ["@conditional"] = { link = "Conditional" }, + ["@repeat"] = { link = "Repeat" }, + ["@debug"] = { link = "Debug" }, + ["@label"] = { link = "Label" }, + ["@include"] = { link = "Include" }, + ["@exception"] = { link = "Exception" }, + ["@type"] = { link = "Type" }, + ["@type.builtin"] = { link = "Type" }, + ["@type.qualifier"] = { link = "Type" }, + ["@type.definition"] = { link = "Typedef" }, + ["@storageclass"] = { link = "StorageClass" }, + ["@attribute"] = { link = "PreProc" }, + ["@field"] = { link = "Identifier" }, + ["@property"] = { link = "Function" }, + ["@variable"] = { link = "Normal" }, + ["@variable.builtin"] = { link = "Special" }, + ["@constant"] = { link = "Constant" }, + ["@constant.builtin"] = { link = "Special" }, + ["@constant.macro"] = { link = "Define" }, + ["@namespace"] = { link = "Include" }, + ["@symbol"] = { link = "Identifier" }, + ["@text"] = { link = "Normal" }, + ["@text.strong"] = { bold = true }, + ["@text.emphasis"] = { italic = true }, + ["@text.underline"] = { underline = true }, + ["@text.strike"] = { strikethrough = true }, + ["@text.title"] = { link = "Title" }, + ["@text.literal"] = { link = "String" }, + ["@text.uri"] = { link = "Underlined" }, + ["@text.math"] = { link = "Special" }, + ["@text.environment"] = { link = "Macro" }, + ["@text.environment.name"] = { link = "Type" }, + ["@text.reference"] = { link = "Constant" }, + ["@text.todo"] = { link = "Todo" }, + ["@text.note"] = hl.predef.BlueItalic, + ["@text.warning"] = hl.predef.YellowItalic, + ["@text.danger"] = hl.predef.RedItalic, + ["@tag"] = { link = "Tag" }, + ["@tag.attribute"] = { link = "Identifier" }, + ["@tag.delimiter"] = { link = "Delimiter" }, + } + + hl.plugins.lsp_semantic_tokens = { + LspNamespace = { link = "@namespace" }, + LspType = { link = "@type" }, + LspClass = { link = "@type" }, + LspEnum = { link = "@constant" }, + LspInterface = { link = "@constant" }, + LspStruct = { link = "@constant" }, + LspTypeParameter = { link = "@type" }, + LspParameter = { link = "@parameter" }, + LspVariable = { link = "@variable" }, + LspProperty = { link = "@property" }, + LspEnumMember = { link = "@constant" }, + LspEvent = { link = "@constant" }, + LspFunction = { link = "@function" }, + LspMethod = { link = "@method" }, + LspMacro = { link = "@constant.macro" }, + LspKeyword = { link = "@keyword" }, + LspModifier = { link = "TSModifier" }, + LspComment = { link = "@comment" }, + LspString = { link = "@string" }, + LspNumber = { link = "@number" }, + LspRegexp = { link = "@string.regex" }, + LspOperator = { link = "@operator" }, + LspDecorator = { link = "@symbol" }, + LspDeprecated = { link = "@text.strike" }, + } +end hl.plugins.cmp = { CmpItemKindDefault = { fg = p.blue, bg = p.none }, diff --git a/lua/tokyodark/utils.lua b/lua/tokyodark/utils.lua index c2a0e4f..77524e2 100644 --- a/lua/tokyodark/utils.lua +++ b/lua/tokyodark/utils.lua @@ -38,4 +38,19 @@ function U.color_gamma(hex, gamma) return string.format("#%02x%02x%02x", r, g, b) end +function U.check_min_version(major, minor, patch) + local version = vim.version() + local current_major = version.major + local current_minor = version.minor + local current_patch = version.patch + if current_major > major then + return true + elseif current_major == major and current_minor > minor then + return true + elseif current_major == major and current_minor == minor and current_patch >= patch then + return true + end + return false +end + return U