-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporate cursorline
highlighting in sign column
#563
Comments
This will require passing the |
This comment was marked as resolved.
This comment was marked as resolved.
Here's a simple solution that makes all signs use the CursorLine background: require("gitsigns").setup()
vim.defer_fn(function()
local cl_bg = vim.api.nvim_get_hl(0, { name = "CursorLine", link = false }).bg
for _, sign in ipairs(vim.fn.sign_getdefined()) do
local hl = vim.api.nvim_get_hl(0, { name = sign.texthl, link = false })
local name = sign.texthl .. "Cul"
vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = cl_bg })
vim.fn.sign_define(sign.name, { culhl = name })
end
end, 100) |
I had to modify @fwrs solution slightly. require 'gitsigns'.setup(opts)
vim.defer_fn(function()
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(vim.fn.sign_getdefined()) do
local hl = vim.api.nvim_get_hl(0, { name = sign.texthl, link = false })
local name = sign.texthl
vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = bg })
name = name .. "Cul"
vim.api.nvim_set_hl(0, name, { fg = hl.fg, bg = cl_bg })
vim.fn.sign_define(sign.name, { culhl = name })
end
end, 10) |
I also have the following to get the vim.api.nvim_create_autocmd({ "BufWinEnter", "WinEnter" }, {
callback = function()
local bg = vim.api.nvim_get_hl(0, { name = "Normal", link = false }).bg
vim.cmd("highlight! SignColumn guibg=" .. bg)
end,
desc = "For active window, set SignColumn background to Normal",
})
vim.api.nvim_create_autocmd("WinLeave", {
callback = function()
local bg = vim.api.nvim_get_hl(0, { name = "NormalNC", link = false }).bg
vim.cmd("highlight! SignColumn guibg=" .. bg)
end,
desc = "For inactive window, set SignColumn background to NormalNC",
}) |
These solutions work for signs, but newer signs use extmarks and extmark namespaces instead. So the above doesn't quite work for me. Might write an updated solutions |
I would greatly appreciate a solution that incorporates extmarks! |
Fwiw I have given up on trying to get it, and I have disabled culhl for all signs |
Done in #1097 |
This is an excellent enhancement, thanks @apollo1321 and @lewis6991. |
Your colorscheme needs to support the new In my experimentation, this feature works well. |
Thanks, I added the new highlight groups and it works. |
Is anybody noticing breakage with statuscol.nvim? Works for me if I disable statuscol.nvim but breaks with it: Might be statuscol.nvim issue |
Created pr to fix this behavior: luukvbaal/statuscol.nvim#133 |
Is your feature request related to a problem? Please describe.
I use
set signcolumn=number
and have my cursor line highlighting extending across the number column like so:I can't find a way to make the
CursorLine
background apply to the signs:Describe the solution you'd like
I would like the lighter-shaded background to extend all the way to the left side of "Another new line".
Describe alternatives you've considered
I've played around with the Neovim and gitsigns highlighting a bunch and cannot get this to happen.
The text was updated successfully, but these errors were encountered: