From 8ee2fb5a7d070e95d70eb6d84279854207c9ecfc Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Tue, 19 Mar 2024 17:56:58 -0500 Subject: [PATCH] refactor(nvim): abandon `culhl` entirely https://www.youtube.com/watch?v=7Sq6ookE6nA --- dots/.config/nvim/lua/plugins/configs/git.lua | 10 +++++ .../nvim/lua/plugins/configs/kanagawa.lua | 11 ++--- .../nvim/lua/plugins/configs/statuscol.lua | 44 ------------------- 3 files changed, 13 insertions(+), 52 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/git.lua b/dots/.config/nvim/lua/plugins/configs/git.lua index 00ad2644..de512ca4 100644 --- a/dots/.config/nvim/lua/plugins/configs/git.lua +++ b/dots/.config/nvim/lua/plugins/configs/git.lua @@ -1,4 +1,14 @@ return { + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 0, + }, + }, + }, { "sindrets/diffview.nvim", keys = { diff --git a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua index be458dc0..57e23283 100644 --- a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua +++ b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua @@ -54,14 +54,9 @@ return { { "WinBarNC", { bg = nil } }, { "Visual", { bg = colors.sumiInk5 } }, { "CursorLine", { bg = colors.sumiInk4 } }, - { "CursorLineNr", { fg = colors.roninYellow, bg = palette.theme.ui.bg_m1 } }, - { "CursorLineFold", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } }, - { "CursorLineSign", { bg = palette.theme.ui.bg_m1 } }, - { "DiagnosticSignErrorCul", { fg = palette.theme.diag.error, bg = palette.theme.ui.bg_m1 } }, - { "DiagnosticSignWarnCul", { fg = palette.theme.diag.warning, bg = palette.theme.ui.bg_m1 } }, - { "DiagnosticSignInfoCul", { fg = palette.theme.diag.info, bg = palette.theme.ui.bg_m1 } }, - { "DiagnosticSignHintCul", { fg = palette.theme.diag.hint, bg = palette.theme.ui.bg_m1 } }, - { "LightBulbSign", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } }, + { "CursorLineNr", { fg = colors.roninYellow } }, + { "CursorLineFold", { fg = colors.crystalBlue } }, + { "LightBulbSign", { fg = colors.crystalBlue } }, { "WinSeparator", { fg = colors.fujiGray } }, { "StatusLine", { fg = colors.fujiWhite, bg = colors.sumiInk0 } }, { "WinBar", { link = "StatusLine" } }, diff --git a/dots/.config/nvim/lua/plugins/configs/statuscol.lua b/dots/.config/nvim/lua/plugins/configs/statuscol.lua index 9d1baeef..8c1afaa4 100644 --- a/dots/.config/nvim/lua/plugins/configs/statuscol.lua +++ b/dots/.config/nvim/lua/plugins/configs/statuscol.lua @@ -24,38 +24,6 @@ return { end, }) - -- 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( - 100, - 100, - vim.schedule_wrap(function() - -- Make all signs support "CusorLine.*" highlights - 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 - 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 and not sign.culhl then - local hl = vim.api.nvim_get_hl(0, { name = name, link = false }) - vim.api.nvim_set_hl(0, name, vim.tbl_deep_extend("force", hl, { bg = bg, force = true })) - local cul_hl_name = name .. "Cul" - vim.api.nvim_set_hl( - 0, - cul_hl_name, - vim.tbl_deep_extend("force", hl, { bg = cl_bg, nocombine = true, force = true }) - ) - sign.culhl = cul_hl_name - vim.fn.sign_define(sign.name, sign) - end - end - end) - ) - return { setopt = true, relculright = false, @@ -67,16 +35,4 @@ return { } end, }, - { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - opts = { - current_line_blame = true, - current_line_blame_opts = { - delay = 0, - }, - -- HACK: This allows the gitsigns to correctly use the culhl for their bg - _extmark_signs = false, - }, - }, }