fix(nvim): better handle setting culhl for signs
This commit is contained in:
parent
ddb4679ee9
commit
bfae2cb59f
@ -65,6 +65,7 @@ return {
|
|||||||
CursorLineNr = { fg = colors.roninYellow, bg = palette.theme.ui.bg_p1 },
|
CursorLineNr = { fg = colors.roninYellow, bg = palette.theme.ui.bg_p1 },
|
||||||
CursorLineFold = { fg = colors.crystalBlue, bg = palette.theme.ui.bg_p1 },
|
CursorLineFold = { fg = colors.crystalBlue, bg = palette.theme.ui.bg_p1 },
|
||||||
CursorLineSign = { 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 },
|
WinSeparator = { fg = colors.fujiGray },
|
||||||
StatusLine = { fg = colors.fujiWhite, bg = colors.sumiInk0 },
|
StatusLine = { fg = colors.fujiWhite, bg = colors.sumiInk0 },
|
||||||
WinBar = { fg = colors.fujiWhite, bg = nil },
|
WinBar = { fg = colors.fujiWhite, bg = nil },
|
||||||
|
@ -79,16 +79,13 @@ return {
|
|||||||
opts = function()
|
opts = function()
|
||||||
local text_icon = ""
|
local text_icon = ""
|
||||||
local nvim_lightbulb = require("nvim-lightbulb")
|
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" }, {
|
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||||
callback = nvim_lightbulb.update_lightbulb,
|
callback = nvim_lightbulb.update_lightbulb,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
link_highlights = false,
|
||||||
sign = {
|
sign = {
|
||||||
priority = 9,
|
enabled = true,
|
||||||
text = text_icon,
|
text = text_icon,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -8,20 +8,20 @@ return {
|
|||||||
-- HACK: Ensure all signs get the correct CursorLineSign set to their "culhl" value
|
-- HACK: Ensure all signs get the correct CursorLineSign set to their "culhl" value
|
||||||
-- This, in effect, extends the CursorLine background highlight into the signcolumn
|
-- This, in effect, extends the CursorLine background highlight into the signcolumn
|
||||||
vim.uv.new_timer():start(
|
vim.uv.new_timer():start(
|
||||||
50,
|
100,
|
||||||
1000,
|
100,
|
||||||
vim.schedule_wrap(function()
|
vim.schedule_wrap(function()
|
||||||
-- Make all signs support "CusorLine.*" highlights
|
-- 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
|
if #signs_defined == last_sign_def_len or #signs_defined == 0 then
|
||||||
return
|
return
|
||||||
end
|
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 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
|
local cl_bg = vim.api.nvim_get_hl(0, { name = "CursorLineSign", link = false }).bg
|
||||||
for _, sign in ipairs(signs_defined) do
|
for _, sign in ipairs(signs_defined) do
|
||||||
local name = sign.texthl
|
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 })
|
local hl = vim.api.nvim_get_hl(0, { name = name, link = false })
|
||||||
vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = bg })
|
vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = bg })
|
||||||
name = name .. "Cul"
|
name = name .. "Cul"
|
||||||
|
Loading…
Reference in New Issue
Block a user