From 96aed177efc356a97feab2b56b9416a9d91a45da Mon Sep 17 00:00:00 2001 From: nullchilly Date: Tue, 12 Jul 2022 13:15:50 +0700 Subject: [PATCH 1/3] fix(g.colors_name): Set colorscheme name --- lua/catppuccin/utils/util.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/catppuccin/utils/util.lua b/lua/catppuccin/utils/util.lua index 51637db..38b3f3a 100644 --- a/lua/catppuccin/utils/util.lua +++ b/lua/catppuccin/utils/util.lua @@ -82,6 +82,7 @@ function util.load(theme) if vim.fn.exists("syntax_on") then vim.cmd("syntax reset") end + g.colors_name = "catppuccin" local custom_highlights = require("catppuccin.config").options.custom_highlights util.properties(theme.properties) From eb5410f250cd50a9f2663857f2cf6d46a9e5ef24 Mon Sep 17 00:00:00 2001 From: nullchilly Date: Tue, 12 Jul 2022 14:00:32 +0700 Subject: [PATCH 2/3] BREAKING CHANGE(performance): Improve nvim_set_hl instead of using commas to separate styles in a highlights group please use a Lua table instead. For example: ```lua style = { "italic", "bold", "underlined" } ``` --- lua/catppuccin/core/integrations/bufferline.lua | 2 +- lua/catppuccin/core/integrations/hop.lua | 4 ++-- lua/catppuccin/core/integrations/mini.lua | 6 +++--- lua/catppuccin/core/integrations/treesitter.lua | 2 +- lua/catppuccin/core/mapper.lua | 2 +- lua/catppuccin/utils/data.lua | 9 --------- lua/catppuccin/utils/util.lua | 14 +++++++++----- 7 files changed, 17 insertions(+), 22 deletions(-) diff --git a/lua/catppuccin/core/integrations/bufferline.lua b/lua/catppuccin/core/integrations/bufferline.lua index bf17205..c4f9128 100644 --- a/lua/catppuccin/core/integrations/bufferline.lua +++ b/lua/catppuccin/core/integrations/bufferline.lua @@ -14,7 +14,7 @@ function M.get(cp) BufferLineFill = { bg = bg_highlight }, BufferLineBackcrust = { fg = cp.text, bg = inactive_bg }, -- others BufferLineBufferVisible = { fg = cp.surface1, bg = inactive_bg }, - BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = "bold,italic" }, -- current + BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = { "bold", "italic" } }, -- current BufferLineTab = { fg = cp.surface1, bg = cp.base }, BufferLineTabSelected = { fg = cp.red, bg = cp.blue }, BufferLineTabClose = { fg = cp.red, bg = inactive_bg }, diff --git a/lua/catppuccin/core/integrations/hop.lua b/lua/catppuccin/core/integrations/hop.lua index 72cd3cf..f4ed799 100644 --- a/lua/catppuccin/core/integrations/hop.lua +++ b/lua/catppuccin/core/integrations/hop.lua @@ -2,9 +2,9 @@ local M = {} function M.get(cp) return { - HopNextKey = { bg = cp.base, fg = cp.peach, style = "bold,underline" }, + HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } }, HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" }, - HopNextKey2 = { bg = cp.base, fg = cp.teal, style = "bold,italic" }, + HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } }, HopUnmatched = { bg = cp.base, fg = cp.overlay0 }, } end diff --git a/lua/catppuccin/core/integrations/mini.lua b/lua/catppuccin/core/integrations/mini.lua index ad2c2c9..4280394 100644 --- a/lua/catppuccin/core/integrations/mini.lua +++ b/lua/catppuccin/core/integrations/mini.lua @@ -17,7 +17,7 @@ function M.get(cp) MiniJump = { fg = cp.overlay2, bg = cp.pink }, - MiniJump2dSpot = { bg = cp.base, fg = cp.peach, style = "bold,underline" }, + MiniJump2dSpot = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } }, MiniStarterCurrent = {}, MiniStarterFooter = { fg = cp.yellow, style = "italic" }, @@ -42,10 +42,10 @@ function M.get(cp) MiniSurround = { bg = cp.pink, fg = cp.surface1 }, - MiniTablineCurrent = { fg = cp.text, bg = cp.base, style = "bold,italic" }, + MiniTablineCurrent = { fg = cp.text, bg = cp.base, style = { "bold", "italic" } }, MiniTablineFill = { bg = bg_highlight }, MiniTablineHidden = { fg = cp.text, bg = inactive_bg }, - MiniTablineModifiedCurrent = { fg = cp.base, bg = cp.text, style = "bold,italic" }, + MiniTablineModifiedCurrent = { fg = cp.base, bg = cp.text, style = { "bold", "italic" } }, MiniTablineModifiedHidden = { fg = inactive_bg, bg = cp.text }, MiniTablineModifiedVisible = { fg = cp.surface1, bg = cp.subtext1 }, MiniTablineTabpagesection = { fg = cp.surface1, bg = cp.base }, diff --git a/lua/catppuccin/core/integrations/treesitter.lua b/lua/catppuccin/core/integrations/treesitter.lua index 2ed684c..3340774 100644 --- a/lua/catppuccin/core/integrations/treesitter.lua +++ b/lua/catppuccin/core/integrations/treesitter.lua @@ -80,7 +80,7 @@ function M.get(cp) -- TSURI = { }; -- Any URI like a link or email. -- -- Markdown tresitter parser support - TSURI = { fg = cp.rosewater, style = "italic,underline" }, -- urls, links and emails + TSURI = { fg = cp.rosewater, style = { "italic", "underline" } }, -- urls, links and emails TSLiteral = { fg = cp.teal, style = "italic" }, -- used for inline code in markdown and for doc in python (""") TSTextReference = { fg = cp.lavender, style = "bold" }, -- references TSTitle = { fg = cp.blue, style = "bold" }, -- titles like: # Example diff --git a/lua/catppuccin/core/mapper.lua b/lua/catppuccin/core/mapper.lua index 2f1f29c..3359662 100644 --- a/lua/catppuccin/core/mapper.lua +++ b/lua/catppuccin/core/mapper.lua @@ -34,7 +34,7 @@ local function get_base() }, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if forecrust (ctermfg OR guifg) is not secp. Directory = { fg = cp.blue }, -- directory names (and other special names in listings) EndOfBuffer = { fg = cp.base }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - ErrorMsg = { fg = cp.red, style = "bold,italic" }, -- error messages on the command line + ErrorMsg = { fg = cp.red, style = { "bold", "italic" } }, -- error messages on the command line VertSplit = { fg = cp.crust }, -- the column separating vertically split windows Folded = { fg = cp.blue, bg = cp.surface1 }, -- line used for closed folds FoldColumn = { bg = cp.base, fg = cp.overlay0 }, -- 'foldcolumn' diff --git a/lua/catppuccin/utils/data.lua b/lua/catppuccin/utils/data.lua index 3be43a8..241f04f 100644 --- a/lua/catppuccin/utils/data.lua +++ b/lua/catppuccin/utils/data.lua @@ -8,13 +8,4 @@ function M.set_of(list) return set end --- https://www.codegrepper.com/code-examples/lua/lua+split+string+on+comma -function M.split(s, delimiter) - local result = {} - for match in (s..delimiter):gmatch("(.-)"..delimiter) do - table.insert(result, match) - end - return result -end - return M diff --git a/lua/catppuccin/utils/util.lua b/lua/catppuccin/utils/util.lua index 38b3f3a..be3e05b 100644 --- a/lua/catppuccin/utils/util.lua +++ b/lua/catppuccin/utils/util.lua @@ -1,9 +1,6 @@ -local udata = require("catppuccin.utils.data") - local g = vim.g local util = {} - local has_nvim07 = vim.fn.has("nvim-0.7") function util.highlight(group, color) @@ -15,8 +12,12 @@ function util.highlight(group, color) else if color.style then if color.style ~= "NONE" then - for _, style in pairs(udata.split(color.style, ",")) do - color[style] = true + if type(color.style) == "table" then + for _, style in ipairs(color.style) do + color[style] = true + end + else + color[color.style] = true end end end @@ -26,6 +27,9 @@ function util.highlight(group, color) end else -- Doc: :h highlight-gui + if color.style and type(color.style) == "table" then + color.style = table.concat(color.style, ",") + end local style = color.style and "gui=" .. color.style or "gui=NONE" local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE" local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE" From 15c5026d78084511cd46863444fa9f2a8323f266 Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Tue, 12 Jul 2022 13:32:22 -0500 Subject: [PATCH 3/3] fix: #177 --- lua/catppuccin/config.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/catppuccin/config.lua b/lua/catppuccin/config.lua index b29ae42..817559d 100644 --- a/lua/catppuccin/config.lua +++ b/lua/catppuccin/config.lua @@ -7,11 +7,11 @@ config.options = { dim_inactive = { enable = false, shade = "dark", - percentage = 0.15 + percentage = 0.15, }, styles = { - comments = "italic", - conditionals = "italic", + comments = { "italic" }, + conditionals = { "italic" }, loops = "NONE", functions = "NONE", keywords = "NONE", @@ -28,16 +28,16 @@ config.options = { native_lsp = { enabled = true, virtual_text = { - errors = "italic", - hints = "italic", - warnings = "italic", - information = "italic", + errors = { "italic" }, + hints = { "italic" }, + warnings = { "italic" }, + information = { "italic" }, }, underlines = { - errors = "underline", - hints = "underline", - warnings = "underline", - information = "underline", + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, }, }, coc_nvim = false,