Rename all Treesitter highlight groups

See: https://github.com/nvim-treesitter/nvim-treesitter/pull/3656

Treesitter highlight groups now all have new names that start with @.
This causes vim-code-dark to be nonfunctional on many Treesitter
syntaxes, notably HTML.

Kept the old names around in case someone needs comptibility with older
version of Neovim and Treesitter. Also, the new @names cause errors on
Vim.
This commit is contained in:
capybarapantsu-xe 2022-11-10 23:50:35 -08:00
commit 14b3e6ac42

View file

@ -30,6 +30,10 @@ fun! <sid>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! <sid>hiTS(g_new, g_old, fg, bg, attr, sp)
call <sid>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 <sid>hi('SpellLocal', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
" Neovim Treesitter:
call <sid>hi('TSError', s:cdRed, {}, 'none', {})
call <sid>hi('TSPunctDelimiter', s:cdFront, {}, 'none', {})
call <sid>hi('TSPunctBracket', s:cdFront, {}, 'none', {})
call <sid>hi('TSPunctSpecial', s:cdFront, {}, 'none', {})
call <sid>hiTS('@error', 'TSError', s:cdRed, {}, 'none', {})
call <sid>hiTS('@punctuation.delimiter', 'TSPunctDelimiter', s:cdFront, {}, 'none', {})
call <sid>hiTS('@punctuation.bracket', 'TSPunctBracket', s:cdFront, {}, 'none', {})
call <sid>hiTS('@punctuation.special', 'TSPunctSpecial', s:cdFront, {}, 'none', {})
" Constant
call <sid>hi('TSConstant', s:cdYellow, {}, 'none', {})
call <sid>hi('TSConstBuiltin', s:cdBlue, {}, 'none', {})
call <sid>hi('TSConstMacro', s:cdBlueGreen, {}, 'none', {})
call <sid>hi('TSStringRegex', s:cdOrange, {}, 'none', {})
call <sid>hi('TSString', s:cdOrange, {}, 'none', {})
call <sid>hi('TSStringEscape', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSCharacter', s:cdOrange, {}, 'none', {})
call <sid>hi('TSNumber', s:cdLightGreen, {}, 'none', {})
call <sid>hi('TSBoolean', s:cdBlue, {}, 'none', {})
call <sid>hi('TSFloat', s:cdLightGreen, {}, 'none', {})
call <sid>hi('TSAnnotation', s:cdYellow, {}, 'none', {})
call <sid>hi('TSAttribute', s:cdBlueGreen, {}, 'none', {})
call <sid>hi('TSNamespace', s:cdBlueGreen, {}, 'none', {})
call <sid>hiTS('@constant', 'TSConstant', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@constant.builtin', 'TSConstBuiltin', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@constant.macro', 'TSConstMacro', s:cdBlueGreen, {}, 'none', {})
call <sid>hiTS('@string.regex', 'TSStringRegex', s:cdOrange, {}, 'none', {})
call <sid>hiTS('@string', 'TSString', s:cdOrange, {}, 'none', {})
call <sid>hiTS('@string.escape', 'TSStringEscape', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@character', 'TSCharacter', s:cdOrange, {}, 'none', {})
call <sid>hiTS('@number', 'TSNumber', s:cdLightGreen, {}, 'none', {})
call <sid>hiTS('@boolean', 'TSBoolean', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@float', 'TSFloat', s:cdLightGreen, {}, 'none', {})
call <sid>hiTS('@annotation', 'TSAnnotation', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@attribute', 'TSAttribute', s:cdBlueGreen, {}, 'none', {})
call <sid>hiTS('@namespace', 'TSNamespace', s:cdBlueGreen, {}, 'none', {})
" Functions
call <sid>hi('TSFuncBuiltin', s:cdYellow, {}, 'none', {})
call <sid>hi('TSFunction', s:cdYellow, {}, 'none', {})
call <sid>hi('TSFuncMacro', s:cdYellow, {}, 'none', {})
call <sid>hi('TSParameter', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSParameterReference', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSMethod', s:cdYellow, {}, 'none', {})
call <sid>hi('TSField', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSProperty', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSConstructor', s:cdBlueGreen, {}, 'none', {})
call <sid>hiTS('@function.builtin', 'TSFuncBuiltin', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@function', 'TSFunction', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@function.macro', 'TSFuncMacro', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@parameter', 'TSParameter', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@parameter.reference', 'TSParameterReference', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@method', 'TSMethod', s:cdYellow, {}, 'none', {})
call <sid>hiTS('@field', 'TSField', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@property', 'TSProperty', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@constructor', 'TSConstructor', s:cdBlueGreen, {}, 'none', {})
" Keywords
call <sid>hi('TSConditional', s:cdPink, {}, 'none', {})
call <sid>hi('TSRepeat', s:cdPink, {}, 'none', {})
call <sid>hi('TSLabel', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSKeyword', s:cdBlue, {}, 'none', {})
call <sid>hi('TSKeywordFunction', s:cdBlue, {}, 'none', {})
call <sid>hi('TSKeywordOperator', s:cdBlue, {}, 'none', {})
call <sid>hi('TSOperator', s:cdFront, {}, 'none', {})
call <sid>hi('TSException', s:cdPink, {}, 'none', {})
call <sid>hi('TSType', s:cdBlueGreen, {}, 'none', {})
call <sid>hi('TSTypeBuiltin', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@conditional', 'TSConditional', s:cdPink, {}, 'none', {})
call <sid>hiTS('@repeat', 'TSRepeat', s:cdPink, {}, 'none', {})
call <sid>hiTS('@label', 'TSLabel', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@keyword', 'TSKeyword', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@keyword.function', 'TSKeywordFunction', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@keyword.operator', 'TSKeywordOperator', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@operator', 'TSOperator', s:cdFront, {}, 'none', {})
call <sid>hiTS('@exception', 'TSException', s:cdPink, {}, 'none', {})
call <sid>hiTS('@type', 'TSType', s:cdBlueGreen, {}, 'none', {})
call <sid>hiTS('@type.builtin', 'TSTypeBuiltin', s:cdBlue, {}, 'none', {})
call <sid>hi('TSStructure', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSInclude', s:cdPink, {}, 'none', {})
call <sid>hiTS('@include', 'TSInclude', s:cdPink, {}, 'none', {})
" Variable
call <sid>hi('TSVariable', s:cdLightBlue, {}, 'none', {})
call <sid>hi('TSVariableBuiltin', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@variable', 'TSVariable', s:cdLightBlue, {}, 'none', {})
call <sid>hiTS('@variable.builtin', 'TSVariableBuiltin', s:cdLightBlue, {}, 'none', {})
" Text
call <sid>hi('TSText', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSStrong', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSEmphasis', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSUnderline', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSTitle', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSLiteral', s:cdYellowOrange, {}, 'none', {})
call <sid>hi('TSURI', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text', 'TSText', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.strong', 'TSStrong', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.emphasis', 'TSEmphasis', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.underline', 'TSUnderline', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.title', 'TSTitle', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.literal', 'TSLiteral', s:cdYellowOrange, {}, 'none', {})
call <sid>hiTS('@text.uri', 'TSURI', s:cdYellowOrange, {}, 'none', {})
" Tags
call <sid>hi('TSTag', s:cdBlue, {}, 'none', {})
call <sid>hi('TSTagDelimiter', s:cdGray, {}, 'none', {})
call <sid>hiTS('@tag', 'TSTag', s:cdBlue, {}, 'none', {})
call <sid>hiTS('@tag.delimiter', 'TSTagDelimiter', s:cdGray, {}, 'none', {})
" Markdown:
call <sid>hi('markdownH1', s:cdBlue, {}, 'bold', {})