(See bottom for a quick fix to skip all the troubleshooting, not sure if it's the best fix, but it does work)
Troubleshooting
The commit, 4e69c2aa27a9a6166870a4383ea13eb4d864a1d7 and later commits, have lead to some issues for my configuration. When pointing packer directly at that commit and later commits I get the following error:
Error executing vim.schedule lua callback: ...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:7: Expected lua string
stack traceback:
[C]: in function 'nvim_get_color_by_name'
...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:7: in function 'get_color'
...im/site/pack/packer/start/modes.nvim/lua/modes/utils.lua:29: in function 'blend'
...are/nvim/site/pack/packer/start/modes.nvim/lua/modes.lua:89: in function 'define'
...are/nvim/site/pack/packer/start/modes.nvim/lua/modes.lua:163: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
This occurs both on the latest stable neovim 0.7 & on the latest version of neovim 0.8 I have traced it down to the removal of a fallback for the normal group, adding back the fallback:
This error popped up for me due to tokyonight.nvim's transparency options. When I comment out vim.g.tokyonight_transparent* the error referenced above goes away.
I suspect this is because the group gets set to none by the transparency options.
Taking a look at the blended colors groups, I noticed the bg color passed to blend is the default_colors.normal:
and as best I can tell utils.get_bg is the core of the problem here.
M.get_bg = function(name, fallback)
vim.notify(vim.inspect(name))
local id = vim.api.nvim_get_hl_id_by_name(name)
vim.notify(vim.inspect(id))
if not id then
return fallback
end
local background = vim.fn.synIDattr(id, 'bg')
vim.notify(vim.inspect(background))
if not background or background == '' then
return fallback
end
return background
end
I've popped in a few notify statements, and here's the output for the normal group:
"Normal" <- The name passed in, seems fine
64 <- We get a valid ID back
"none" <- synIDattr fails to get the background :/
The issue is with vim.fn.synIDattr, it's giving back a none value and since no fallback is defined this entire function throws back a none value leading to the error up top.
Recreating the Error
To recreate the error you can pass in the following commands to neovim's command line (assuming you have a proper installation of modes):
highlight Normal guibg=#00000
lua require("modes").setup()
At this point above, no errors should be shown as the Normalbg group is not none.
highlight Normal guibg=NONE
lua require("modes").setup()
Now the error should appear.
Potential Fix
The most expedient way to resolve this is to add back the fallback for the normal group:
(See bottom for a quick fix to skip all the troubleshooting, not sure if it's the best fix, but it does work)
Troubleshooting
The commit, 4e69c2aa27a9a6166870a4383ea13eb4d864a1d7 and later commits, have lead to some issues for my configuration. When pointing packer directly at that commit and later commits I get the following error:
This occurs both on the latest stable neovim
0.7
& on the latest version of neovim0.8
I have traced it down to the removal of a fallback for thenormal
group, adding back the fallback:clears this error for me.
This error popped up for me due to tokyonight.nvim's transparency options. When I comment out
vim.g.tokyonight_transparent*
the error referenced above goes away.I suspect this is because the group gets set to
none
by the transparency options.Taking a look at the blended colors groups, I noticed the
bg
color passed toblend
is thedefault_colors.normal
:and the
default_colors.normal
is defined asand as best I can tell
utils.get_bg
is the core of the problem here.I've popped in a few notify statements, and here's the output for the normal group:
The issue is with
vim.fn.synIDattr
, it's giving back anone
value and since no fallback is defined this entire function throws back anone
value leading to the error up top.Recreating the Error
To recreate the error you can pass in the following commands to neovim's command line (assuming you have a proper installation of modes):
At this point above, no errors should be shown as the
Normal
bg
group is notnone
.Now the error should appear.
Potential Fix
The most expedient way to resolve this is to add back the fallback for the normal group: