diff --git a/lua/catppuccin/groups/integrations/treesitter.lua b/lua/catppuccin/groups/integrations/treesitter.lua index 5b3c2ccc..df03f0fe 100644 --- a/lua/catppuccin/groups/integrations/treesitter.lua +++ b/lua/catppuccin/groups/integrations/treesitter.lua @@ -12,122 +12,131 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci return {} end - return { -- Reference: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md + local colors = { -- Reference: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md + -- Identifiers + ["@variable"] = { fg = C.text, style = O.styles.variables or {} }, -- Any variable name that does not have another highlight. + ["@variable.builtin"] = { fg = C.red, style = O.styles.properties or {} }, -- Variable names that are defined by the languages, like this or self. + ["@variable.parameter"] = { fg = C.maroon, style = O.styles.variables or {} }, -- For parameters of a function. + ["@variable.member"] = { fg = C.lavender }, -- For fields. - -- Misc - ["@comment"] = { link = "Comment" }, - ["@error"] = { link = "Error" }, - ["@preproc"] = { link = "PreProc" }, -- various preprocessor directives & shebangs - ["@define"] = { link = "Define" }, -- preprocessor definition directives - ["@operator"] = { link = "Operator" }, -- For any operator: +, but also -> and * in C. + ["@constant"] = { link = "Constant" }, -- For constants + ["@constant.builtin"] = { fg = C.peach, style = O.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua. + ["@constant.macro"] = { link = "Macro" }, -- For constants that are defined by macros: NULL in C. - -- Punctuation - ["@punctuation.delimiter"] = { link = "Delimiter" }, -- For delimiters (e.g. `;` / `.` / `,`). - ["@punctuation.bracket"] = { fg = C.overlay2 }, -- For brackets and parenthesis. - ["@punctuation.special"] = { link = "Special" }, -- For special punctuation that does not fall in the categories before (e.g. `{}` in string interpolation). + ["@module"] = { fg = C.lavender, style = { "italic" } }, -- For identifiers referring to modules and namespaces. + ["@label"] = { link = "Label" }, -- For labels: label: in C and :label: in Lua. -- Literals ["@string"] = { link = "String" }, -- For strings. - ["@string.regex"] = { fg = C.peach, style = O.styles.strings or {} }, -- For regexes. + ["@string.regexp"] = { fg = C.peach, style = O.styles.strings or {} }, -- For regexes. ["@string.escape"] = { fg = C.pink, style = O.styles.strings or {} }, -- For escape characters within a string. ["@string.special"] = { link = "Special" }, -- other special strings (e.g. dates) + ["@string.special.symbol"] = { fg = C.flamingo }, + ["@string.special.url"] = { fg = C.rosewater, style = { "italic", "underline" } }, -- urls, links and emails ["@character"] = { link = "Character" }, -- character literals ["@character.special"] = { link = "SpecialChar" }, -- special characters (e.g. wildcards) ["@boolean"] = { link = "Boolean" }, -- For booleans. ["@number"] = { link = "Number" }, -- For all numbers - ["@float"] = { link = "Float" }, -- For floats. + ["@number.float"] = { link = "Float" }, -- For floats. + + -- Types + ["@type"] = { link = "Type" }, -- For types. + ["@type.builtin"] = { fg = C.yellow, style = O.styles.properties or { "italic" } }, -- For builtin types. + ["@type.definition"] = { link = "Type" }, -- type definitions (e.g. `typedef` in C) + ["@type.qualifier"] = { link = "Keyword" }, -- type qualifiers (e.g. `const`) + + ["@attribute"] = { link = "Constant" }, -- attribute annotations (e.g. Python decorators) + ["@property"] = { fg = C.lavender, style = O.styles.properties or {} }, -- Same as TSField. -- Functions ["@function"] = { link = "Function" }, -- For function (calls and definitions). ["@function.builtin"] = { fg = C.peach, style = O.styles.functions or {} }, -- For builtin functions: table.insert in Lua. ["@function.call"] = { link = "Function" }, -- function calls ["@function.macro"] = { fg = C.teal, style = O.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Rust. - ["@method"] = { link = "Function" }, -- For method definitions. - ["@method.call"] = { link = "Function" }, -- For method calls. + + ["@function.method"] = { link = "Function" }, -- For method definitions. + ["@function.method.call"] = { link = "Function" }, -- For method calls. ["@constructor"] = { fg = C.sapphire }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. - ["@parameter"] = { fg = C.maroon, style = O.styles.variables or {} }, -- For parameters of a function. + ["@operator"] = { link = "Operator" }, -- For any operator: +, but also -> and * in C. -- Keywords ["@keyword"] = { link = "Keyword" }, -- For keywords that don't fall in previous categories. ["@keyword.function"] = { fg = C.mauve, style = O.styles.keywords or {} }, -- For keywords used to define a function. ["@keyword.operator"] = { fg = C.mauve, style = O.styles.operators or {} }, -- For new keyword operator + ["@keyword.import"] = { link = "Include" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. + ["@keyword.storage"] = { link = "StorageClass" }, -- visibility/life-time/etc. modifiers (e.g. `static`) + ["@keyword.repeat"] = { link = "Repeat" }, -- For keywords related to loops. ["@keyword.return"] = { fg = C.mauve, style = O.styles.keywords or {} }, + ["@keyword.exception"] = { link = "Exception" }, -- For exception related keywords. + + ["@keyword.conditional"] = { link = "Conditional" }, -- For keywords related to conditionnals. + + ["@keyword.directive"] = { link = "PreProc" }, -- various preprocessor directives & shebangs + ["@keyword.directive.define"] = { link = "Define" }, -- preprocessor definition directives -- JS & derivative ["@keyword.export"] = { fg = C.sky, style = O.styles.keywords }, - ["@conditional"] = { link = "Conditional" }, -- For keywords related to conditionnals. - ["@repeat"] = { link = "Repeat" }, -- For keywords related to loops. - -- @debug ; keywords related to debugging - ["@label"] = { link = "Label" }, -- For labels: label: in C and :label: in Lua. - ["@include"] = { link = "Include" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. - ["@exception"] = { link = "Exception" }, -- For exception related keywords. + -- Punctuation + ["@punctuation.delimiter"] = { link = "Delimiter" }, -- For delimiters (e.g. `;` / `.` / `,`). + ["@punctuation.bracket"] = { fg = C.overlay2 }, -- For brackets and parenthesis. + ["@punctuation.special"] = { link = "Special" }, -- For special punctuation that does not fall in the categories before (e.g. `{}` in string interpolation). - -- Types - ["@type"] = { link = "Type" }, -- For types. - ["@type.builtin"] = { fg = C.yellow, style = O.styles.properties or { "italic" } }, -- For builtin types. - ["@type.definition"] = { link = "Type" }, -- type definitions (e.g. `typedef` in C) - ["@type.qualifier"] = { link = "Keyword" }, -- type qualifiers (e.g. `const`) + -- Comment + ["@comment"] = { link = "Comment" }, - ["@storageclass"] = { link = "StorageClass" }, -- visibility/life-time/etc. modifiers (e.g. `static`) - ["@attribute"] = { link = "Constant" }, -- attribute annotations (e.g. Python decorators) - ["@field"] = { fg = C.lavender }, -- For fields. - ["@property"] = { fg = C.lavender, style = O.styles.properties or {} }, -- Same as TSField. + ["@comment.error"] = { fg = C.base, bg = C.red }, + ["@comment.warning"] = { fg = C.base, bg = C.yellow }, + ["@comment.note"] = { fg = C.base, bg = C.blue }, - -- Identifiers + -- Markup + ["@markup"] = { fg = C.text }, -- For strings considerated text in a markup language. + ["@markup.strong"] = { fg = C.maroon, style = { "bold" } }, -- bold + ["@markup.italic"] = { fg = C.maroon, style = { "italic" } }, -- italic + ["@markup.strikethrough"] = { fg = C.text, style = { "strikethrough" } }, -- strikethrough text + ["@markup.underline"] = { link = "Underline" }, -- underlined text - ["@variable"] = { fg = C.text, style = O.styles.variables or {} }, -- Any variable name that does not have another highlight. - ["@variable.builtin"] = { fg = C.red, style = O.styles.properties or {} }, -- Variable names that are defined by the languages, like this or self. + ["@markup.heading"] = { fg = C.blue, style = { "bold" } }, -- titles like: # Example - ["@constant"] = { link = "Constant" }, -- For constants - ["@constant.builtin"] = { fg = C.peach, style = O.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua. - ["@constant.macro"] = { link = "Macro" }, -- For constants that are defined by macros: NULL in C. + ["@markup.math"] = { fg = C.blue }, -- math environments (e.g. `$ ... $` in LaTeX) + ["@markup.environment"] = { fg = C.pink }, -- text environments of markup languages + ["@markup.environment.name"] = { fg = C.blue }, -- text indicating the type of an environment + + ["@markup.link"] = { link = "Tag" }, -- text references, footnotes, citations, etc. + ["@markup.link.url"] = { fg = C.rosewater, style = { "italic", "underline" } }, -- urls, links and emails - ["@namespace"] = { fg = C.lavender, style = { "italic" } }, -- For identifiers referring to modules and namespaces. - ["@symbol"] = { fg = C.flamingo }, - - -- Text - ["@text"] = { fg = C.text }, -- For strings considerated text in a markup language. - ["@text.strong"] = { fg = C.maroon, style = { "bold" } }, -- bold - ["@text.emphasis"] = { fg = C.maroon, style = { "italic" } }, -- italic - ["@text.underline"] = { link = "Underline" }, -- underlined text - ["@text.strike"] = { fg = C.text, style = { "strikethrough" } }, -- strikethrough text - ["@text.title"] = { fg = C.blue, style = { "bold" } }, -- titles like: # Example - ["@text.literal"] = { fg = C.teal }, -- used for inline code in markdown and for doc in python (""") - ["@text.uri"] = { fg = C.rosewater, style = { "italic", "underline" } }, -- urls, links and emails - ["@text.math"] = { fg = C.blue }, -- math environments (e.g. `$ ... $` in LaTeX) - ["@text.environment"] = { fg = C.pink }, -- text environments of markup languages - ["@text.environment.name"] = { fg = C.blue }, -- text indicating the type of an environment - ["@text.reference"] = { link = "Tag" }, -- text references, footnotes, citations, etc. - - ["@text.todo"] = { fg = C.base, bg = C.yellow }, -- todo notes - ["@text.todo.checked"] = { fg = C.green }, -- todo notes - ["@text.todo.unchecked"] = { fg = C.overlay1 }, -- todo notes - ["@text.note"] = { fg = C.base, bg = C.blue }, - ["@text.warning"] = { fg = C.base, bg = C.yellow }, - ["@text.danger"] = { fg = C.base, bg = C.red }, - - ["@text.diff.add"] = { link = "diffAdded" }, -- added text (for diff files) - ["@text.diff.delete"] = { link = "diffRemoved" }, -- deleted text (for diff files) + ["@markup.raw"] = { fg = C.teal }, -- used for inline code in markdown and for doc in python (""") + + ["@markup.list"] = { link = "Special" }, + ["@markup.list.checked"] = { fg = C.green }, -- todo notes + ["@markup.list.unchecked"] = { fg = C.overlay1 }, -- todo notes + + -- Diff + ["@diff.plus"] = { link = "diffAdded" }, -- added text (for diff files) + ["@diff.minus"] = { link = "diffRemoved" }, -- deleted text (for diff files) + ["@diff.delta"] = { link = "diffChanged" }, -- deleted text (for diff files) -- Tags ["@tag"] = { fg = C.mauve }, -- Tags like html tag names. ["@tag.attribute"] = { fg = C.teal, style = { "italic" } }, -- Tags like html tag names. ["@tag.delimiter"] = { fg = C.sky }, -- Tag delimiter like < > / + -- Misc + ["@error"] = { link = "Error" }, + -- Language specific: -- bash ["@function.builtin.bash"] = { fg = C.red, style = { "italic" } }, -- markdown - ["@text.title.2.markdown"] = { link = "rainbow2" }, - ["@text.title.1.markdown"] = { link = "rainbow1" }, - ["@text.title.3.markdown"] = { link = "rainbow3" }, - ["@text.title.4.markdown"] = { link = "rainbow4" }, - ["@text.title.5.markdown"] = { link = "rainbow5" }, - ["@text.title.6.markdown"] = { link = "rainbow6" }, + ["@markup.heading.1.markdown"] = { link = "rainbow1" }, + ["@markup.heading.2.markdown"] = { link = "rainbow2" }, + ["@markup.heading.3.markdown"] = { link = "rainbow3" }, + ["@markup.heading.4.markdown"] = { link = "rainbow4" }, + ["@markup.heading.5.markdown"] = { link = "rainbow5" }, + ["@markup.heading.6.markdown"] = { link = "rainbow6" }, -- java ["@constant.java"] = { fg = C.teal }, @@ -159,14 +168,14 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci ["@tag.attribute.tsx"] = { fg = C.mauve, style = { "italic" } }, -- yaml - ["@field.yaml"] = { fg = C.blue }, -- For fields. + ["@variable.member.yaml"] = { fg = C.blue }, -- For fields. -- Ruby - ["@symbol.ruby"] = { fg = C.flamingo }, + ["@string.special.symbol.ruby"] = { fg = C.flamingo }, -- PHP - ["@method.php"] = { link = "Function" }, - ["@method.call.php"] = { link = "Function" }, + ["@function.method.php"] = { link = "Function" }, + ["@function.method.call.php"] = { link = "Function" }, -- C/CPP ["@type.builtin.c"] = { fg = C.yellow, style = {} }, @@ -177,6 +186,72 @@ If you want to stay on nvim 0.7, either disable the integration or pin catppucci gitcommitSummary = { fg = C.rosewater, style = { "italic" } }, zshKSHFunction = { link = "Function" }, } + + -- Legacy highlights + colors["@parameter"] = colors["@variable.parameter"] + colors["@field"] = colors["@variable.member"] + colors["@namespace"] = colors["@module"] + colors["@float"] = colors["number.float"] + colors["@symbol"] = colors["@string.special.symbol"] + colors["@string.regex"] = colors["@string.regexp"] + + colors["@text"] = colors["@markup"] + colors["@text.strong"] = colors["@markup.strong"] + colors["@text.emphasis"] = colors["@markup.italic"] + colors["@text.underline"] = colors["@markup.underline"] + colors["@text.strike"] = colors["@markup.strikethrough"] + colors["@text.uri"] = colors["@markup.link.url"] + colors["@text.math"] = colors["@markup.math"] + colors["@text.environment"] = colors["@markup.environment"] + colors["@text.environment.name"] = colors["@markup.environment.name"] + + colors["@text.title"] = colors["@markup.heading"] + colors["@text.literal"] = colors["@markup.raw"] + colors["@text.reference"] = colors["@markup.link"] + + colors["@text.todo.checked"] = colors["@markup.list.checked"] + colors["@text.todo.unchecked"] = colors["@markup.list.unchecked"] + + -- @text.todo is now for todo comments, not todo notes like in markdown + colors["@text.todo"] = colors["comment.warning"] + colors["@text.warning"] = colors["comment.warning"] + colors["@text.note"] = colors["comment.note"] + colors["@text.danger"] = colors["comment.error"] + + -- @text.uri is now + -- @markup.link.url in markup links + -- @string.special.url outside of markup + colors["text.uri"] = colors["@markup.link.uri"] + + colors["@method"] = colors["@function.method"] + colors["@method.call"] = colors["@function.method.call"] + + colors["@text.diff.add"] = colors["@diff.plus"] + colors["@text.diff.delete"] = colors["@diff.minus"] + + colors["@define"] = colors["@keyword.directive.define"] + colors["@preproc"] = colors["@keyword.directive"] + colors["@storageclass"] = colors["@keyword.storage"] + colors["@conditional"] = colors["@keyword.conditional"] + colors["exception"] = colors["@keyword.exception"] + colors["@include"] = colors["@keyword.import"] + colors["@repeat"] = colors["@keyword.repeat"] + + colors["@symbol.ruby"] = colors["@string.special.symbol.ruby"] + + colors["@variable.member.yaml"] = colors["@field.yaml"] + + colors["@text.title.1.markdown"] = colors["@markup.heading.1.markdown"] + colors["@text.title.2.markdown"] = colors["@markup.heading.2.markdown"] + colors["@text.title.3.markdown"] = colors["@markup.heading.3.markdown"] + colors["@text.title.4.markdown"] = colors["@markup.heading.4.markdown"] + colors["@text.title.5.markdown"] = colors["@markup.heading.5.markdown"] + colors["@text.title.6.markdown"] = colors["@markup.heading.6.markdown"] + + colors["@method.php"] = colors["@function.method.php"] + colors["@method.call.php"] = colors["@function.method.call.php"] + + return colors end return M