-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Support for "LineNr" highlight #8
Comments
Thanks for the suggestion. I'm sure that it's something that can be easily implemented. |
Plus one here, otherwise it's not possible to have separate highlighting of text & signs. It would be nice also to support existing GitGutterXxxLineNr groups, as a few colorscheme add support for that. |
I've got this working locally (was pretty simple infact), the only thing I'm struggling with is how to configure this. My current plan is to add My other idea was to just take the highlight group used for signs and reverse it for the numhl but not sure if this is too restricted. Opinions? Ideally I'd like enabling this feature to be as simple as possible (hence the second idea), but would also like to allow flexibility. |
Implemented this in #20. Can merge if people are ok with this. |
I found that I had to add
in order to see any colors (which is fine if intended!). Works like a charm though, thanks! |
The intention is that if Can you check if something gets automatically defined by removing the |
I get |
Interesting, that is unintended. Not sure why it doesn't work, the code is pretty simple: for t, sign_name in pairs(sign_map) do
local cs = config.signs[t]
if config.numhl and not hl_exists(cs.numhl) then
-- If highlight 'numhl' is not defined, create it to be the reverse of
-- texthl highlight fg->bg
local ctermfg = api.nvim_get_hl_by_name(cs.hl, false).foreground
local ctermbg = ctermfg and ('ctermbg=%d'):format(ctermfg) or ''
local guifg = api.nvim_get_hl_by_name(cs.hl, true).foreground
local guibg = guifg and ('guibg=#%x'):format(guifg) or ''
if ctermbg ~= '' or guibg ~= '' then
vim.cmd(('highlight %s %s %s'):format(cs.numhl, ctermbg, guibg))
end
end
sign_define(sign_name, {
texthl = cs.hl,
text = cs.text,
numhl = config.numhl and cs.numhl
})
end With :lua print(vim.api.nvim_get_hl_by_name('GitSignsAddNr', false)) is And if it's not much to ask, could you add a few Otherwise we can just submit the PR as is and figure this issue at some other point in the future. |
Can confirm the above lua snippet errors in the expected way. A few things I noticed:
|
Thanks for investigating.
So that implies
Well that's strange. What's the definitions for the highlights you use in
This is for a different feature that I haven't documented yet (see #14) so I wouldn't expect that branch to execute. Without being able to reproduce your env there's not much I can do. Would you be able to debug further? Otherwise we can just submit? |
yes cs.numhl matches the default config values
I'm not setting these, they are what the default values the plugin defines are.
I'm on a very recent (like friday) version of master of neovim. I can dig up the precise commit if you think that's important. In any case, I can always just explicitly set the highlights myself that i mentioned above (which seem to exactly match the behavior that happens if i make the changes i mentioned in my previous comment to make it work), so I'm happy either way to keep debugging or leave it be |
The default numhl highlights aren't defined by default and get defined during setup via that conditional. You can find out if they are defined by running
before you run
Then you'll be using
Don't worry, I'm sure it's recent enough. |
Oh, I thought you meant literally
Yields:
|
I'm not sure if that's the correct name, but I've recently been keeping my sign column off because gitgutter is able to add highlights to the number column through GitGutterAddLineNr, GitGutterChangeLineNr, GitGutterDeleteLineNr, and GitGutterChangeDeleteLineNr.
The text was updated successfully, but these errors were encountered: