Open John-Colvin opened 2 months ago
If you don't set a bg for Statement
, Vim should show whatever the background is for the "previous/surrounding" highlight group, eg Normal
, CursorLine
, etc.
eg
Or do I misunderstand the question? Vim can't embed any logic in the actual groups, so you can't have conditional stuff outside of actually altering what groups are applied via treesitter/the syntax file.
That isn't what I'm seeing, I must be doing something wrong.
Config:
local lush = require('lush')
local hsl = lush.hsl
local theme = lush(function(injected_functions)
local sym = injected_functions.sym
return {
Statement { gui = "bold" }, -- (*) Any statement
PreProc { bg = hsl("#ff0000") }, -- (*) Generic Preprocessor
}
end)
return theme
Result:
Ah I see. I missed that the target group was PreProc
in the first post. I guess it's not possible, something specific to how PreProc is applied? It seems that the default PreProc
group for neovim only applies a fg color, perhaps for this reason.
You can see here where Statement
's background correctly "falls through" for CursorLine
(return
, nullptr
) vs Normal
(if
).
You can see the raw lines lua/vimscript lines that lush would generate via those lushwright
lines if you want to try and debug/reproduce outside of Lush (check :messages
, each element in the table is a line, so for the lua output they're elements of a table, for vimscript each is its own command. Dont forget to include a :hi clear
.).
{ 'Normal = {bg = "#996666"},', 'CursorLine = {bg = "#669999"},', 'PreProc = {bg = "#FF0000"},', "Statement = {bold = true}," }
{ "highlight Normal guifg=NONE guibg=#996666 guisp=NONE blend=NONE gui=NONE", "highlight CursorLine guifg=NONE guibg=#669999 guisp=NONE blend=NONE gui=NONE", "highlight PreProc guifg=NONE guibg=#FF0000 guisp=NONE blend=NONE gui=NONE", "highlight Statement guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=bold" }
E.g. is there any way to avoid the gaps in the background for
if
,return
&nullptr
while still being able to style them in general?It would be manageable to only have one background possible, e.g. if I set a background on
Statement
then it would always take precedence, but it seems that I can't even express something like "Statements should be bold & have the background of whatever they are part of".