You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.9.5
Operating system/version
macOS 14.2
Describe the bug
Setting a custom provider highlight name using a function does create a highlight name using it's other properties (e.g. fg / bg) instead of using the predefined name.
Check output of :filter /^FelineStatusbarViMode/ highlight which should be empty
Check output of :filter /^StatusComponent_/ highlight which should output the auto-generated hl: StatusComponent_ffffff_ff0000_NONE xxx guifg=#ffffff guibg=#ff0000
Expected Behavior
I would expect that Feline does create a hl for me but uses the predefined name FelineStatusbarViMode instead of the fallback StatusComponent_...
Hello @steschwa, thanks for posting. I think I'm a little confused by the bug report. When using a highlight name (i.e. string), the intention is that the highlight has already been defined and you want to use it for the component.
For example, if you used nvim_set_hl to create the highlight group FelineStatusbarViMode then you would reference it in the component hl config:
If you're wanting feline to handle the highlight for the component, specifying a name doesn't really matter since it will be created internally and used for the life of the component.
All you really need to provide is the fg, bg, and style properties for the hl to achieve what you need (at least in the example).
I agree that this part is a little confusing as an example and might possibly be incorrect. Perhaps this was how the highlighting used to work at some point. I will look through the code to try and understand what the objective here is:
-- As a function returning a table
hl = function()
return {
name = require('feline.providers.vi_mode').get_mode_highlight_name(),
fg = require('feline.providers.vi_mode').get_mode_color(),
style = 'bold'
}
end
Is something not not working? From what I see in your example, all you need for the component is:
Oh yeah i think i just got confused by the example. My understanding was that
"if i specify a name, feline uses that name to generate a hl group (using fg/bg and style)".
Using a name key when hl is a table doesn't make much sense then i guess.
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.5
Operating system/version
macOS 14.2
Describe the bug
Setting a custom provider highlight name using a function does create a highlight name using it's other properties (e.g.
fg
/bg
) instead of using the predefined name.The example in USAGE.md doesn't work either. The Name of the hl should be something like
StatusComponentVim...
(according to https://github.com/freddiehaddad/feline.nvim/blob/main/lua/feline/providers/vi_mode.lua#L56) but rather createsStatusComponent_60A040_1F1F23_bold
TLDR: After some digging around i found
function parse_hl
https://github.com/freddiehaddad/feline.nvim/blob/main/lua/feline/generator.lua#L120, which just ignores the predefinedhl.name
. My naive approach was to just return thehl.name
or generate a new name if none was passed and that seems to workSteps To Reproduce
:filter /^FelineStatusbarViMode/ highlight
which should be empty:filter /^StatusComponent_/ highlight
which should output the auto-generated hl:StatusComponent_ffffff_ff0000_NONE xxx guifg=#ffffff guibg=#ff0000
Expected Behavior
I would expect that Feline does create a hl for me but uses the predefined name
FelineStatusbarViMode
instead of the fallbackStatusComponent_...
Repro
The text was updated successfully, but these errors were encountered: