Skip to content

Commit

Permalink
Updated new treesitter highlights to support neovim 0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev authored and navarasu committed Oct 19, 2022
1 parent 6c72a9c commit fc90c12
Showing 1 changed file with 125 additions and 61 deletions.
186 changes: 125 additions & 61 deletions lua/onedark/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,67 +130,131 @@ hl.syntax = {
Todo = {fg = c.red, fmt = cfg.code_style.comments}
}

hl.treesitter = {
TSAnnotation = colors.Fg,
TSAttribute = colors.Cyan,
TSBoolean = colors.Orange,
TSCharacter = colors.Orange,
TSComment = {fg = c.grey, fmt = cfg.code_style.comments},
TSConditional = {fg = c.purple, fmt = cfg.code_style.keywords},
TSConstant = colors.Orange,
TSConstBuiltin = colors.Orange,
TSConstMacro = colors.Orange,
TSConstructor = {fg = c.yellow, fmt = "bold"},
TSError = colors.Fg,
TSException = colors.Purple,
TSField = colors.Cyan,
TSFloat = colors.Orange,
TSFunction = {fg = c.blue, fmt = cfg.code_style.functions},
TSFuncBuiltin = {fg = c.cyan, fmt = cfg.code_style.functions},
TSFuncMacro = {fg = c.cyan, fmt = cfg.code_style.functions},
TSInclude = colors.Purple,
TSKeyword = {fg = c.purple, fmt = cfg.code_style.keywords},
TSKeywordFunction = {fg = c.purple, fmt = cfg.code_style.functions},
TSKeywordOperator = {fg = c.purple, fmt = cfg.code_style.keywords},
TSLabel = colors.Red,
TSMethod = colors.Blue,
TSNamespace = colors.Yellow,
TSNone = colors.Fg,
TSNumber = colors.Orange,
TSOperator = colors.Fg,
TSParameter = colors.Red,
TSParameterReference = colors.Fg,
TSProperty = colors.Cyan,
TSPunctDelimiter = colors.LightGrey,
TSPunctBracket = colors.LightGrey,
TSPunctSpecial = colors.Red,
TSRepeat = {fg = c.purple, fmt = cfg.code_style.keywords},
TSString = {fg = c.green, fmt = cfg.code_style.strings},
TSStringRegex = {fg = c.orange, fmt = cfg.code_style.strings},
TSStringEscape = {fg = c.red, fmt = cfg.code_style.strings},
TSSymbol = colors.Cyan,
TSTag = colors.Red,
TSTagDelimiter = colors.Red,
TSText = colors.Fg,
TSStrong = {fg = c.fg, fmt = 'bold'},
TSEmphasis = {fg = c.fg, fmt = 'italic'},
TSUnderline = {fg = c.fg, fmt = 'underline'},
TSStrike = {fg = c.fg, fmt = 'strikethrough'},
TSTitle = {fg = c.orange, fmt = 'bold'},
TSLiteral = colors.Green,
TSURI = {fg = c.cyan, fmt = 'underline'},
TSMath = colors.Fg,
TSTextReference = colors.Blue,
TSEnviroment = colors.Fg,
TSEnviromentName = colors.Fg,
TSNote = colors.Fg,
TSWarning = colors.Fg,
TSDanger = colors.Fg,
TSType = colors.Yellow,
TSTypeBuiltin = colors.Orange,
TSVariable = {fg = c.fg, fmt = cfg.code_style.variables},
TSVariableBuiltin = {fg = c.red, fmt = cfg.code_style.variables},
}
if vim.api.nvim_call_function("has", { "nvim-0.8" }) == 1 then
hl.treesitter = {
["@annotation"] = colors.Fg,
["@attribute"] = colors.Cyan,
["@boolean"] = colors.Orange,
["@character"] = colors.Orange,
["@comment"] = {fg = c.grey, fmt = cfg.code_style.comments},
["@conditional"] = {fg = c.purple, fmt = cfg.code_style.keywords},
["@constant"] = colors.Orange,
["@constant.builtin"] = colors.Orange,
["@constant.macro"] = colors.Orange,
["@constructor"] = {fg = c.yellow, fmt = "bold"},
["@error"] = colors.Fg,
["@exception"] = colors.Purple,
["@field"] = colors.Cyan,
["@float"] = colors.Orange,
["@function"] = {fg = c.blue, fmt = cfg.code_style.functions},
["@function.builtin"] = {fg = c.cyan, fmt = cfg.code_style.functions},
["@function.macro"] = {fg = c.cyan, fmt = cfg.code_style.functions},
["@include"] = colors.Purple,
["@keyword"] = {fg = c.purple, fmt = cfg.code_style.keywords},
["@keyword.function"] = {fg = c.purple, fmt = cfg.code_style.functions},
["@keyword.operator"] = {fg = c.purple, fmt = cfg.code_style.keywords},
["@label"] = colors.Red,
["@method"] = colors.Blue,
["@namespace"] = colors.Yellow,
["@none"] = colors.Fg,
["@number"] = colors.Orange,
["@operator"] = colors.Fg,
["@parameter"] = colors.Red,
["@parameter.reference"] = colors.Fg,
["@property"] = colors.Cyan,
["@punctuation.delimiter"] = colors.LightGrey,
["@punctuation.bracket"] = colors.LightGrey,
["@punctuation.special"] = colors.Red,
["@repeat"] = {fg = c.purple, fmt = cfg.code_style.keywords},
["@string"] = {fg = c.green, fmt = cfg.code_style.strings},
["@string.regex"] = {fg = c.orange, fmt = cfg.code_style.strings},
["@string.escape"] = {fg = c.red, fmt = cfg.code_style.strings},
["@symbol"] = colors.Cyan,
["@tag"] = colors.Red,
["@tag.delimiter"] = colors.Red,
["@text"] = colors.Fg,
["@text.strong"] = {fg = c.fg, fmt = 'bold'},
["@text.emphasis"] = {fg = c.fg, fmt = 'italic'},
["@text.underline"] = {fg = c.fg, fmt = 'underline'},
["@text.strike"] = {fg = c.fg, fmt = 'strikethrough'},
["@text.title"] = {fg = c.orange, fmt = 'bold'},
["@text.literal"] = colors.Green,
["@text.uri"] = {fg = c.cyan, fmt = 'underline'},
["@text.math"] = colors.Fg,
["@text.reference"] = colors.Blue,
["@text.enviroment"] = colors.Fg,
["@text.enviroment.name"] = colors.Fg,
["@note"] = colors.Fg,
["@warning"] = colors.Fg,
["@danger"] = colors.Fg,
["@type"] = colors.Yellow,
["@type.builtin"] = colors.Orange,
["@variable"] = {fg = c.fg, fmt = cfg.code_style.variables},
["@variable.builtin"] = {fg = c.red, fmt = cfg.code_style.variables},
}
else
hl.treesitter = {
TSAnnotation = colors.Fg,
TSAttribute = colors.Cyan,
TSBoolean = colors.Orange,
TSCharacter = colors.Orange,
TSComment = {fg = c.grey, fmt = cfg.code_style.comments},
TSConditional = {fg = c.purple, fmt = cfg.code_style.keywords},
TSConstant = colors.Orange,
TSConstBuiltin = colors.Orange,
TSConstMacro = colors.Orange,
TSConstructor = {fg = c.yellow, fmt = "bold"},
TSError = colors.Fg,
TSException = colors.Purple,
TSField = colors.Cyan,
TSFloat = colors.Orange,
TSFunction = {fg = c.blue, fmt = cfg.code_style.functions},
TSFuncBuiltin = {fg = c.cyan, fmt = cfg.code_style.functions},
TSFuncMacro = {fg = c.cyan, fmt = cfg.code_style.functions},
TSInclude = colors.Purple,
TSKeyword = {fg = c.purple, fmt = cfg.code_style.keywords},
TSKeywordFunction = {fg = c.purple, fmt = cfg.code_style.functions},
TSKeywordOperator = {fg = c.purple, fmt = cfg.code_style.keywords},
TSLabel = colors.Red,
TSMethod = colors.Blue,
TSNamespace = colors.Yellow,
TSNone = colors.Fg,
TSNumber = colors.Orange,
TSOperator = colors.Fg,
TSParameter = colors.Red,
TSParameterReference = colors.Fg,
TSProperty = colors.Cyan,
TSPunctDelimiter = colors.LightGrey,
TSPunctBracket = colors.LightGrey,
TSPunctSpecial = colors.Red,
TSRepeat = {fg = c.purple, fmt = cfg.code_style.keywords},
TSString = {fg = c.green, fmt = cfg.code_style.strings},
TSStringRegex = {fg = c.orange, fmt = cfg.code_style.strings},
TSStringEscape = {fg = c.red, fmt = cfg.code_style.strings},
TSSymbol = colors.Cyan,
TSTag = colors.Red,
TSTagDelimiter = colors.Red,
TSText = colors.Fg,
TSStrong = {fg = c.fg, fmt = 'bold'},
TSEmphasis = {fg = c.fg, fmt = 'italic'},
TSUnderline = {fg = c.fg, fmt = 'underline'},
TSStrike = {fg = c.fg, fmt = 'strikethrough'},
TSTitle = {fg = c.orange, fmt = 'bold'},
TSLiteral = colors.Green,
TSURI = {fg = c.cyan, fmt = 'underline'},
TSMath = colors.Fg,
TSTextReference = colors.Blue,
TSEnviroment = colors.Fg,
TSEnviromentName = colors.Fg,
TSNote = colors.Fg,
TSWarning = colors.Fg,
TSDanger = colors.Fg,
TSType = colors.Yellow,
TSTypeBuiltin = colors.Orange,
TSVariable = {fg = c.fg, fmt = cfg.code_style.variables},
TSVariableBuiltin = {fg = c.red, fmt = cfg.code_style.variables},
}
end

local diagnostics_error_color = cfg.diagnostics.darker and c.dark_red or c.red
local diagnostics_hint_color = cfg.diagnostics.darker and c.dark_purple or c.purple
Expand Down

0 comments on commit fc90c12

Please sign in to comment.