From c75562cbc954136f279ced91661251543b6f2a20 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Tue, 4 Jul 2023 18:41:12 +0200 Subject: [PATCH 1/5] fix(mapper): remove unnecessary globals (#529) --- lua/catppuccin/lib/mapper.lua | 62 ++++++++++++++--------------------- vim.yml | 7 ++++ 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/lua/catppuccin/lib/mapper.lua b/lua/catppuccin/lib/mapper.lua index 4139421e8..bca81f689 100644 --- a/lua/catppuccin/lib/mapper.lua +++ b/lua/catppuccin/lib/mapper.lua @@ -1,39 +1,12 @@ local M = {} -local function get_integrations() - local integrations = O["integrations"] - local final_integrations = {} - - for integration in pairs(integrations) do - local cot = false - if type(integrations[integration]) == "table" then - if integrations[integration]["enabled"] == true then cot = true end - else - if integrations[integration] == true then cot = true end - end - - if cot then - final_integrations = vim.tbl_deep_extend( - "force", - final_integrations, - require("catppuccin.groups.integrations." .. integration).get() - ) - end - end - - return final_integrations -end - function M.apply(flavour) flavour = flavour or require("catppuccin").flavour - -- Borrowing global var - _G._O = O - _G._C = C - _G._U = U - _G.O = require("catppuccin").options - _G.C = require("catppuccin.palettes").get_palette(flavour) - _G.U = require "catppuccin.utils.colors" + local _O, _C, _U = O, C, U -- Borrowing global var (setfenv doesn't work with require) + O = require("catppuccin").options + C = require("catppuccin.palettes").get_palette(flavour) + U = require "catppuccin.utils.colors" C.none = "NONE" @@ -51,9 +24,27 @@ function M.apply(flavour) local theme = {} theme.syntax = require("catppuccin.groups.syntax").get() theme.editor = require("catppuccin.groups.editor").get() - theme.integrations = get_integrations() -- plugins + local final_integrations = {} + + for integration in pairs(O.integrations) do + local cot = false + if type(O.integrations[integration]) == "table" then + if O.integrations[integration].enabled == true then cot = true end + else + if O.integrations[integration] == true then cot = true end + end + + if cot then + final_integrations = vim.tbl_deep_extend( + "force", + final_integrations, + require("catppuccin.groups.integrations." .. integration).get() + ) + end + end + theme.integrations = final_integrations -- plugins theme.terminal = require("catppuccin.groups.terminal").get() -- terminal colors - local user_highlights = require("catppuccin").options.highlight_overrides + local user_highlights = O.highlight_overrides if type(user_highlights[flavour]) == "function" then user_highlights[flavour] = user_highlights[flavour](C) end theme.custom_highlights = vim.tbl_deep_extend( "keep", @@ -61,10 +52,7 @@ function M.apply(flavour) type(user_highlights.all) == "function" and user_highlights.all(C) or user_highlights.all or {} ) - -- Returning global var - _G.O = _G._O - _G.C = _G._C - _G.U = _G._U + O, C, U = _O, _C, _U -- Returning global var return theme end diff --git a/vim.yml b/vim.yml index 26dd37323..dcb4d933f 100644 --- a/vim.yml +++ b/vim.yml @@ -37,6 +37,13 @@ globals: args: - type: function + C: + property: full-write + O: + property: full-write + U: + property: full-write + C.rosewater: type: string property: read-only From cc8d3abc944d78cb6bf2a4cc88871ab383c4da62 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Wed, 5 Jul 2023 12:13:08 -0400 Subject: [PATCH 2/5] feat(integrations): add rainbow_delimiters.nvim support (#530) --- README.md | 14 ++++++++++++++ doc/catppuccin.txt | 4 ++++ .../groups/integrations/rainbow_delimiters.lua | 15 +++++++++++++++ lua/catppuccin/init.lua | 1 + lua/catppuccin/types.lua | 1 + vim.yml | 3 +++ 6 files changed, 38 insertions(+) create mode 100644 lua/catppuccin/groups/integrations/rainbow_delimiters.lua diff --git a/README.md b/README.md index f9cc6e5cc..9276a35e8 100644 --- a/README.md +++ b/README.md @@ -1118,6 +1118,20 @@ pounce = false + + + + rainbow-delimiters.nvim + + +```lua +rainbow_delimiters = true +``` + + + + + diff --git a/doc/catppuccin.txt b/doc/catppuccin.txt index 3a2f41b85..5daf919e0 100644 --- a/doc/catppuccin.txt +++ b/doc/catppuccin.txt @@ -701,6 +701,10 @@ pounce.nvim>lua pounce = false < +rainbow-delimiters.nvim>lua + rainbow_delimiters = true +< + symbols-outline.nvim>lua symbols_outline = false < diff --git a/lua/catppuccin/groups/integrations/rainbow_delimiters.lua b/lua/catppuccin/groups/integrations/rainbow_delimiters.lua new file mode 100644 index 000000000..bfaeecf71 --- /dev/null +++ b/lua/catppuccin/groups/integrations/rainbow_delimiters.lua @@ -0,0 +1,15 @@ +local M = {} + +function M.get() + return { + RainbowDelimiterRed = { fg = C.red }, + RainbowDelimiterYellow = { fg = C.yellow }, + RainbowDelimiterBlue = { fg = C.blue }, + RainbowDelimiterOrange = { fg = C.peach }, + RainbowDelimiterGreen = { fg = C.green }, + RainbowDelimiterViolet = { fg = C.mauve }, + RainbowDelimiterCyan = { fg = C.teal }, + } +end + +return M diff --git a/lua/catppuccin/init.lua b/lua/catppuccin/init.lua index 3dbdb227a..ed82b522d 100644 --- a/lua/catppuccin/init.lua +++ b/lua/catppuccin/init.lua @@ -41,6 +41,7 @@ local M = { gitsigns = true, markdown = true, nvimtree = true, + rainbow_delimiters = true, semantic_tokens = not is_vim, telescope = { enabled = true, diff --git a/lua/catppuccin/types.lua b/lua/catppuccin/types.lua index a7d92f256..8dc91550c 100644 --- a/lua/catppuccin/types.lua +++ b/lua/catppuccin/types.lua @@ -60,6 +60,7 @@ ---@field native_lsp CtpIntegrationNativeLsp ---@field navic CtpIntegrationNavic ---@field nvimtree boolean +---@field rainbow_delimiters boolean ---@field semantic_tokens boolean ---@field telescope CtpIntegrationTelescope ---@field treesitter boolean diff --git a/vim.yml b/vim.yml index dcb4d933f..5e1ed3822 100644 --- a/vim.yml +++ b/vim.yml @@ -251,6 +251,9 @@ globals: O.integrations.ts_rainbow2: type: bool property: read-only + O.integrations.rainbow_delimiters: + type: bool + property: read-only O.integrations.barbecue.dim_dirname: type: bool From d438c0141609338140b18363a9a1e8eb8bb17130 Mon Sep 17 00:00:00 2001 From: Null Chilly Date: Fri, 7 Jul 2023 20:52:11 +0700 Subject: [PATCH 3/5] fix(which-key): wrong separator highlight group --- .../groups/integrations/which_key.lua | 2 +- tests/setup_spec.lua | 107 ++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/lua/catppuccin/groups/integrations/which_key.lua b/lua/catppuccin/groups/integrations/which_key.lua index fd9b46050..3983d449f 100644 --- a/lua/catppuccin/groups/integrations/which_key.lua +++ b/lua/catppuccin/groups/integrations/which_key.lua @@ -6,7 +6,7 @@ function M.get() WhichKeyBorder = { link = "FloatBorder" }, WhichKeyGroup = { fg = C.blue }, - WhichKeySeperator = { fg = C.overlay0 }, + WhichKeySeparator = { fg = C.overlay0 }, WhichKeyDesc = { fg = C.pink }, WhichKeyValue = { fg = C.overlay0 }, } diff --git a/tests/setup_spec.lua b/tests/setup_spec.lua index 695f71b26..d5a467bc2 100644 --- a/tests/setup_spec.lua +++ b/tests/setup_spec.lua @@ -125,6 +125,113 @@ local configs = { end, }, }, + backwardspy = { + flavour = os.getenv "appearance" == "light" and "latte" or "mocha", + integrations = { + gitsigns = true, + indent_blankline = { enabled = true }, + leap = true, + mini = true, + neotree = true, + noice = true, + cmp = true, + notify = true, + treesitter = true, + telescope = true, + which_key = true, + }, + color_overrides = { + mocha = { + base = "#171717", + mantle = "#101010", + crust = "#0C0C0C", + }, + }, + custom_highlights = function(colors) + local utils = require "catppuccin.utils.colors" + local tint = function(tint) return utils.blend(tint, colors.base, 0.2) end + + return { + -- + -- notify + -- + NotifyBackground = { bg = colors.mantle }, + -- + -- noice + -- + NoiceCmdlinePopup = { bg = colors.mantle }, + NoiceCmdlinePopupBorder = { bg = colors.mantle, fg = colors.mantle }, + -- + -- telescope + -- + TelescopeMatching = { fg = colors.yellow }, + TelescopeSelection = { fg = colors.text, bg = colors.surface0 }, + -- results + TelescopeResultsNormal = { bg = colors.mantle }, + TelescopeResultsBorder = { bg = colors.mantle, fg = colors.mantle }, + TelescopeResultsTitle = { fg = colors.mantle }, + -- prompt + TelescopePromptNormal = { bg = colors.surface0 }, + TelescopePromptBorder = { bg = colors.surface0, fg = colors.surface0 }, + TelescopePromptTitle = { bg = colors.teal, fg = colors.mantle }, + TelescopePromptPrefix = { bg = colors.surface0 }, + -- preview + TelescopePreviewNormal = { bg = colors.crust }, + TelescopePreviewBorder = { bg = colors.crust, fg = colors.crust }, + TelescopePreviewTitle = { bg = colors.pink, fg = colors.mantle }, + -- + -- neotree + -- + NeoTreeNormal = { bg = colors.mantle }, + NeoTreeNormalNC = { bg = colors.mantle }, + -- + -- cmp + -- + PmenuSel = { bg = colors.mantle, fg = "NONE" }, + Pmenu = { fg = colors.text, bg = colors.crust }, + + CmpItemAbbrDeprecated = { fg = colors.overlay0, bg = "NONE", style = { "strikethrough" } }, + CmpItemAbbrMatch = { fg = colors.yellow, bg = "NONE", style = { "bold" } }, + CmpItemAbbrMatchFuzzy = { fg = colors.yellow, bg = "NONE", style = { "bold" } }, + CmpItemMenu = { fg = colors.lavender, bg = "NONE", style = { "italic" } }, + + CmpItemKindField = { fg = colors.rosewater, bg = tint(colors.rosewater) }, + CmpItemKindProperty = { fg = colors.rosewater, bg = tint(colors.rosewater) }, + CmpItemKindEvent = { fg = colors.rosewater, bg = tint(colors.rosewater) }, + + CmpItemKindText = { fg = colors.text, bg = tint(colors.text) }, + CmpItemKindModule = { fg = colors.text, bg = tint(colors.text) }, + CmpItemKindVariable = { fg = colors.text, bg = tint(colors.text) }, + CmpItemKindFile = { fg = colors.text, bg = tint(colors.text) }, + CmpItemKindUnit = { fg = colors.text, bg = tint(colors.text) }, + CmpItemKindValue = { fg = colors.text, bg = tint(colors.text) }, + + CmpItemKindEnum = { fg = colors.yellow, bg = tint(colors.yellow) }, + CmpItemKindReference = { fg = colors.yellow, bg = tint(colors.yellow) }, + CmpItemKindClass = { fg = colors.yellow, bg = tint(colors.yellow) }, + CmpItemKindFolder = { fg = colors.yellow, bg = tint(colors.yellow) }, + CmpItemKindEnumMember = { fg = colors.yellow, bg = tint(colors.yellow) }, + CmpItemKindInterface = { fg = colors.yellow, bg = tint(colors.yellow) }, + + CmpItemKindKeyword = { fg = colors.mauve, bg = tint(colors.mauve) }, + + CmpItemKindConstant = { fg = colors.peach, bg = tint(colors.peach) }, + + CmpItemKindConstructor = { fg = colors.lavender, bg = tint(colors.lavender) }, + + CmpItemKindFunction = { fg = colors.blue, bg = tint(colors.blue) }, + CmpItemKindMethod = { fg = colors.blue, bg = tint(colors.blue) }, + + CmpItemKindStruct = { fg = colors.teal, bg = tint(colors.teal) }, + CmpItemKindOperator = { fg = colors.teal, bg = tint(colors.teal) }, + + CmpItemKindSnippet = { fg = colors.flamingo, bg = tint(colors.flamingo) }, + + CmpItemKindColor = { fg = colors.pink, bg = tint(colors.pink) }, + CmpItemKindTypeParameter = { fg = colors.maroon, bg = tint(colors.maroon) }, + } + end, + }, } describe("setup", function() From 15043d363729f1ef20e615c41bbd8b7e92c1453e Mon Sep 17 00:00:00 2001 From: Null Chilly Date: Fri, 7 Jul 2023 20:55:08 +0700 Subject: [PATCH 4/5] fix(tests): shadowing variable --- tests/setup_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/setup_spec.lua b/tests/setup_spec.lua index d5a467bc2..b64067371 100644 --- a/tests/setup_spec.lua +++ b/tests/setup_spec.lua @@ -149,7 +149,7 @@ local configs = { }, custom_highlights = function(colors) local utils = require "catppuccin.utils.colors" - local tint = function(tint) return utils.blend(tint, colors.base, 0.2) end + local tint = function(color) return utils.blend(color, colors.base, 0.2) end return { -- From 278bfeb61bd627dc2a8885180a0441a1ebe65a41 Mon Sep 17 00:00:00 2001 From: Null Chilly Date: Fri, 7 Jul 2023 20:59:30 +0700 Subject: [PATCH 5/5] feat(navic): change text color because teal is not the prettiest --- lua/catppuccin/groups/integrations/navic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/catppuccin/groups/integrations/navic.lua b/lua/catppuccin/groups/integrations/navic.lua index c5e3e7147..e53a77cf4 100644 --- a/lua/catppuccin/groups/integrations/navic.lua +++ b/lua/catppuccin/groups/integrations/navic.lua @@ -32,7 +32,7 @@ function M.get() NavicIconsEvent = { fg = C.blue, bg = background }, NavicIconsOperator = { fg = C.sky, bg = background }, NavicIconsTypeParameter = { fg = C.blue, bg = background }, - NavicText = { fg = C.teal, bg = background }, + NavicText = { fg = C.sapphire, bg = background }, NavicSeparator = { fg = C.text, bg = background }, } end