diff --git a/colors/codedark.vim b/colors/codedark.vim index 1adb360..28523d7 100644 --- a/colors/codedark.vim +++ b/colors/codedark.vim @@ -30,6 +30,10 @@ fun! hi(group, fg, bg, attr, sp) exec "hi " . a:group . " guisp=" . a:sp.gui endif endfun +" Choose old or new name for Treesitter groups depending on Neovim version +fun! hiTS(g_new, g_old, fg, bg, attr, sp) + call hi(has("nvim-0.8.0")? a:g_new : a:g_old, a:fg, a:bg, a:attr, a:sp) +endfun " ------------------ " Color definitions: @@ -243,61 +247,61 @@ call hi('SpellLocal', s:cdRed, s:cdBack, 'undercurl', s:cdRed) " Neovim Treesitter: -call hi('TSError', s:cdRed, {}, 'none', {}) -call hi('TSPunctDelimiter', s:cdFront, {}, 'none', {}) -call hi('TSPunctBracket', s:cdFront, {}, 'none', {}) -call hi('TSPunctSpecial', s:cdFront, {}, 'none', {}) +call hiTS('@error', 'TSError', s:cdRed, {}, 'none', {}) +call hiTS('@punctuation.delimiter', 'TSPunctDelimiter', s:cdFront, {}, 'none', {}) +call hiTS('@punctuation.bracket', 'TSPunctBracket', s:cdFront, {}, 'none', {}) +call hiTS('@punctuation.special', 'TSPunctSpecial', s:cdFront, {}, 'none', {}) " Constant -call hi('TSConstant', s:cdYellow, {}, 'none', {}) -call hi('TSConstBuiltin', s:cdBlue, {}, 'none', {}) -call hi('TSConstMacro', s:cdBlueGreen, {}, 'none', {}) -call hi('TSStringRegex', s:cdOrange, {}, 'none', {}) -call hi('TSString', s:cdOrange, {}, 'none', {}) -call hi('TSStringEscape', s:cdYellowOrange, {}, 'none', {}) -call hi('TSCharacter', s:cdOrange, {}, 'none', {}) -call hi('TSNumber', s:cdLightGreen, {}, 'none', {}) -call hi('TSBoolean', s:cdBlue, {}, 'none', {}) -call hi('TSFloat', s:cdLightGreen, {}, 'none', {}) -call hi('TSAnnotation', s:cdYellow, {}, 'none', {}) -call hi('TSAttribute', s:cdBlueGreen, {}, 'none', {}) -call hi('TSNamespace', s:cdBlueGreen, {}, 'none', {}) +call hiTS('@constant', 'TSConstant', s:cdYellow, {}, 'none', {}) +call hiTS('@constant.builtin', 'TSConstBuiltin', s:cdBlue, {}, 'none', {}) +call hiTS('@constant.macro', 'TSConstMacro', s:cdBlueGreen, {}, 'none', {}) +call hiTS('@string.regex', 'TSStringRegex', s:cdOrange, {}, 'none', {}) +call hiTS('@string', 'TSString', s:cdOrange, {}, 'none', {}) +call hiTS('@string.escape', 'TSStringEscape', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@character', 'TSCharacter', s:cdOrange, {}, 'none', {}) +call hiTS('@number', 'TSNumber', s:cdLightGreen, {}, 'none', {}) +call hiTS('@boolean', 'TSBoolean', s:cdBlue, {}, 'none', {}) +call hiTS('@float', 'TSFloat', s:cdLightGreen, {}, 'none', {}) +call hiTS('@annotation', 'TSAnnotation', s:cdYellow, {}, 'none', {}) +call hiTS('@attribute', 'TSAttribute', s:cdBlueGreen, {}, 'none', {}) +call hiTS('@namespace', 'TSNamespace', s:cdBlueGreen, {}, 'none', {}) " Functions -call hi('TSFuncBuiltin', s:cdYellow, {}, 'none', {}) -call hi('TSFunction', s:cdYellow, {}, 'none', {}) -call hi('TSFuncMacro', s:cdYellow, {}, 'none', {}) -call hi('TSParameter', s:cdLightBlue, {}, 'none', {}) -call hi('TSParameterReference', s:cdLightBlue, {}, 'none', {}) -call hi('TSMethod', s:cdYellow, {}, 'none', {}) -call hi('TSField', s:cdLightBlue, {}, 'none', {}) -call hi('TSProperty', s:cdLightBlue, {}, 'none', {}) -call hi('TSConstructor', s:cdBlueGreen, {}, 'none', {}) +call hiTS('@function.builtin', 'TSFuncBuiltin', s:cdYellow, {}, 'none', {}) +call hiTS('@function', 'TSFunction', s:cdYellow, {}, 'none', {}) +call hiTS('@function.macro', 'TSFuncMacro', s:cdYellow, {}, 'none', {}) +call hiTS('@parameter', 'TSParameter', s:cdLightBlue, {}, 'none', {}) +call hiTS('@parameter.reference', 'TSParameterReference', s:cdLightBlue, {}, 'none', {}) +call hiTS('@method', 'TSMethod', s:cdYellow, {}, 'none', {}) +call hiTS('@field', 'TSField', s:cdLightBlue, {}, 'none', {}) +call hiTS('@property', 'TSProperty', s:cdLightBlue, {}, 'none', {}) +call hiTS('@constructor', 'TSConstructor', s:cdBlueGreen, {}, 'none', {}) " Keywords -call hi('TSConditional', s:cdPink, {}, 'none', {}) -call hi('TSRepeat', s:cdPink, {}, 'none', {}) -call hi('TSLabel', s:cdLightBlue, {}, 'none', {}) -call hi('TSKeyword', s:cdBlue, {}, 'none', {}) -call hi('TSKeywordFunction', s:cdBlue, {}, 'none', {}) -call hi('TSKeywordOperator', s:cdBlue, {}, 'none', {}) -call hi('TSOperator', s:cdFront, {}, 'none', {}) -call hi('TSException', s:cdPink, {}, 'none', {}) -call hi('TSType', s:cdBlueGreen, {}, 'none', {}) -call hi('TSTypeBuiltin', s:cdBlue, {}, 'none', {}) +call hiTS('@conditional', 'TSConditional', s:cdPink, {}, 'none', {}) +call hiTS('@repeat', 'TSRepeat', s:cdPink, {}, 'none', {}) +call hiTS('@label', 'TSLabel', s:cdLightBlue, {}, 'none', {}) +call hiTS('@keyword', 'TSKeyword', s:cdBlue, {}, 'none', {}) +call hiTS('@keyword.function', 'TSKeywordFunction', s:cdBlue, {}, 'none', {}) +call hiTS('@keyword.operator', 'TSKeywordOperator', s:cdBlue, {}, 'none', {}) +call hiTS('@operator', 'TSOperator', s:cdFront, {}, 'none', {}) +call hiTS('@exception', 'TSException', s:cdPink, {}, 'none', {}) +call hiTS('@type', 'TSType', s:cdBlueGreen, {}, 'none', {}) +call hiTS('@type.builtin', 'TSTypeBuiltin', s:cdBlue, {}, 'none', {}) call hi('TSStructure', s:cdLightBlue, {}, 'none', {}) -call hi('TSInclude', s:cdPink, {}, 'none', {}) +call hiTS('@include', 'TSInclude', s:cdPink, {}, 'none', {}) " Variable -call hi('TSVariable', s:cdLightBlue, {}, 'none', {}) -call hi('TSVariableBuiltin', s:cdLightBlue, {}, 'none', {}) +call hiTS('@variable', 'TSVariable', s:cdLightBlue, {}, 'none', {}) +call hiTS('@variable.builtin', 'TSVariableBuiltin', s:cdLightBlue, {}, 'none', {}) " Text -call hi('TSText', s:cdYellowOrange, {}, 'none', {}) -call hi('TSStrong', s:cdYellowOrange, {}, 'none', {}) -call hi('TSEmphasis', s:cdYellowOrange, {}, 'none', {}) -call hi('TSUnderline', s:cdYellowOrange, {}, 'none', {}) -call hi('TSTitle', s:cdYellowOrange, {}, 'none', {}) -call hi('TSLiteral', s:cdYellowOrange, {}, 'none', {}) -call hi('TSURI', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text', 'TSText', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.strong', 'TSStrong', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.emphasis', 'TSEmphasis', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.underline', 'TSUnderline', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.title', 'TSTitle', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.literal', 'TSLiteral', s:cdYellowOrange, {}, 'none', {}) +call hiTS('@text.uri', 'TSURI', s:cdYellowOrange, {}, 'none', {}) " Tags -call hi('TSTag', s:cdBlue, {}, 'none', {}) -call hi('TSTagDelimiter', s:cdGray, {}, 'none', {}) +call hiTS('@tag', 'TSTag', s:cdBlue, {}, 'none', {}) +call hiTS('@tag.delimiter', 'TSTagDelimiter', s:cdGray, {}, 'none', {}) " Markdown: call hi('markdownH1', s:cdBlue, {}, 'bold', {})