mirror of
https://github.com/neovim/neovim.git
synced 2026-07-13 12:50:31 +00:00
fix(startup): emitting useless OptionSet #39830
Problem: During startup, we manually trigger a useless and misleading `OptionSet` event, which doesn't set `v:option_*` values (this is a limitation of `nvim_exec_autocmds`).ad4bc2d90c/runtime/lua/vim/_core/defaults.lua (L939). Solution: The `nvim_exec_autocmds('OptionSet',…)` call does not serve any purpose since5cbb9d613b, so just drop it.
This commit is contained in:
@@ -946,20 +946,6 @@ do
|
||||
local luminance = (0.299 * rr) + (0.587 * gg) + (0.114 * bb)
|
||||
local bg = luminance < 0.5 and 'dark' or 'light'
|
||||
vim.api.nvim_set_option_value('background', bg, {})
|
||||
|
||||
-- Ensure OptionSet still triggers when we set the background during startup
|
||||
if vim.v.vim_did_enter == 0 then
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
group = group,
|
||||
once = true,
|
||||
nested = true,
|
||||
callback = function()
|
||||
vim.api.nvim_exec_autocmds('OptionSet', {
|
||||
pattern = 'background',
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user