This was needed historically, but I thought it might be causing
inconsistent behavior nowadays.
I was seeing errors in Corpus if I activated it too soon after opening
Vim (no errors if I waited though).
Error detected while processing function <SNR>106_CheckColorScheme:
E5108: Error executing lua ...g/nvim/pack/bundle/opt/pinnacle/lua/wincent/pinnacle.lua:25: attempt to index local 'original' (a nil value)
E416: missing equal sign: 0
E416: missing equal sign: null
(Many of these, but those show the basic patterns.)
Adding some debug info, I could see that the `:hi` command we were
trying to use was returning empty strings for some of the groups:
{
"StatusLine: StatusLine xxx ctermfg=12 ctermbg=11 guifg=#b8b8b8 guibg=#383838",
"MatchParen: MatchParen xxx ctermbg=8 guibg=#585858",
"StatusLine: StatusLine xxx ctermfg=12 ctermbg=11 guifg=#b8b8b8 guibg=#383838",
"Comment: Comment xxx ctermfg=8 guifg=#585858",
"DiffText: DiffText xxx cterm=bold ctermfg=4 ctermbg=10 gui=bold guifg=#7cafc2 guibg=#282828",
"ModeMsg: ModeMsg xxx cterm=bold ctermfg=2 gui=bold guifg=#a1b56c",
"StatusLine: StatusLine xxx ctermfg=12 ctermbg=11 guifg=#b8b8b8 guibg=#383838",
"MatchParen: MatchParen xxx ctermbg=8 guibg=#585858",
"StatusLine: StatusLine xxx ctermfg=12 ctermbg=11 guifg=#b8b8b8 guibg=#383838",
"Comment:",
"DiffText:",
"ModeMsg:",
"StatusLine:",
"PmenuSel:",
"Underlined:",
"ModeMsg:"
}
So, this explains the errors. Our `capture_highlight` call is
occasionally getting an empty string back. Subsequent attempts to match
a pattern in the string fail, leading to a `nil` return on the Lua side
and a `null` coercion on the Vim side. I have no idea why the first few
calls all work fine and subsequent calls, even for groups like `ModeMsg`
that previously worked, do not.
In this commit I drop the `silent` in an effort to make the errors go
away. It doesn't work (we're still getting empty strings), but it does
show that we don't need the silent any more, so let's just go with it
and keep exploring.
-- Gets the current value of a highlight group.
pinnacle.capture_highlight = function(group)
- return vim.api.nvim_exec('0verbose silent highlight ' .. group, true)
+ return vim.api.nvim_exec('0verbose highlight ' .. group, true)
end
-- Returns a copy of `group` decorated with `style` (eg. "bold",