From bfae2cb59f123aab6e83c366ef14156c200a1482 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Fri, 2 Feb 2024 21:38:52 -0600 Subject: [PATCH] fix(nvim): better handle setting culhl for signs --- dots/.config/nvim/lua/plugins/configs/kanagawa.lua | 1 + dots/.config/nvim/lua/plugins/configs/lsp.lua | 7 ++----- dots/.config/nvim/lua/plugins/configs/statuscol.lua | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua index c5bef28b..de5d3f4e 100644 --- a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua +++ b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua @@ -65,6 +65,7 @@ return { CursorLineNr = { fg = colors.roninYellow, bg = palette.theme.ui.bg_p1 }, CursorLineFold = { fg = colors.crystalBlue, bg = palette.theme.ui.bg_p1 }, CursorLineSign = { bg = palette.theme.ui.bg_p1 }, + LightBulbSign = { fg = colors.crystalBlue, bg = palette.theme.ui.bg_p1 }, WinSeparator = { fg = colors.fujiGray }, StatusLine = { fg = colors.fujiWhite, bg = colors.sumiInk0 }, WinBar = { fg = colors.fujiWhite, bg = nil }, diff --git a/dots/.config/nvim/lua/plugins/configs/lsp.lua b/dots/.config/nvim/lua/plugins/configs/lsp.lua index 529e7f39..0921d71e 100644 --- a/dots/.config/nvim/lua/plugins/configs/lsp.lua +++ b/dots/.config/nvim/lua/plugins/configs/lsp.lua @@ -79,16 +79,13 @@ return { opts = function() local text_icon = "" local nvim_lightbulb = require("nvim-lightbulb") - vim.fn.sign_define( - "LightBulbSign", - { text = text_icon, numhl = "DiagnosticSignHint", texthl = "DiagnosticSignHint", priority = 9 } - ) vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { callback = nvim_lightbulb.update_lightbulb, }) return { + link_highlights = false, sign = { - priority = 9, + enabled = true, text = text_icon, }, } diff --git a/dots/.config/nvim/lua/plugins/configs/statuscol.lua b/dots/.config/nvim/lua/plugins/configs/statuscol.lua index 26574d4e..e10c5aa6 100644 --- a/dots/.config/nvim/lua/plugins/configs/statuscol.lua +++ b/dots/.config/nvim/lua/plugins/configs/statuscol.lua @@ -8,20 +8,20 @@ return { -- HACK: Ensure all signs get the correct CursorLineSign set to their "culhl" value -- This, in effect, extends the CursorLine background highlight into the signcolumn vim.uv.new_timer():start( - 50, - 1000, + 100, + 100, vim.schedule_wrap(function() -- Make all signs support "CusorLine.*" highlights - local signs_defined = vim.fn.sign_getdefined() + local signs_defined = vim.fn.sign_getdefined() or {} if #signs_defined == last_sign_def_len or #signs_defined == 0 then return end - last_sign_def_len = signs_defined + last_sign_def_len = #signs_defined local bg = vim.api.nvim_get_hl(0, { name = "SignColumn", link = false }).bg local cl_bg = vim.api.nvim_get_hl(0, { name = "CursorLineSign", link = false }).bg for _, sign in ipairs(signs_defined) do local name = sign.texthl - if name then + if name and not sign.culhl then local hl = vim.api.nvim_get_hl(0, { name = name, link = false }) vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = bg }) name = name .. "Cul"