-
Notifications
You must be signed in to change notification settings - Fork 2
Description
It seems like on my particular colorscheme, the syntax file errors out with:
E420: BG color unknown
It happens on this line:
hi cdeckInvisible guifg=bg guibg=bg ctermbg=bg ctermfg=bg
The problem, I think, is that the "bg" color only works if the Normal
syntax group has a set background. In my case (a custom colorscheme), it looks like this:
hi Normal cterm=NONE ctermfg=White
hi Normal guifg=#dddddd guibg=Black
Even if I set ctermbg=NONE
, it's the same issue -- it seems like it only works if there's a concrete color set, or I might be doing something wrong. The reason I'm not setting a specific color is because I'm using transparency in my terminal, so I'd like to keep this functionality.
Unfortunately, I'm not sure what a solution might look like. It would be nice if there was a way to check if "bg" was defined. This could work as a best-effort kind of thing, maybe:
try
hi cdeckInvisible guifg=bg guibg=bg ctermbg=bg ctermfg=bg
catch /E420:/
" No "bg" set, let's try our best to hide it:
if &background == 'dark'
hi cdeckInvisible guifg=Black guibg=Black ctermbg=Black ctermfg=Black
elseif &background == 'light'
hi cdeckInvisible guifg=White guibg=White ctermbg=White ctermfg=White
endif
endtry
I've attached #3 as a PR that implements this fix.