-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Normal
highlight slightly different just after running :Lazy build
#753
Comments
Odd, I even got it to reproduce using the |
@folke (sorry for the ping) on closer inspection, the This minimal repro might be better:
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{"folke/tokyonight.nvim", build = function()
vim.cmd.colorscheme("tokyonight")
vim.print(vim.g.colors_name, vim.api.nvim_get_hl(0, {name = 'Normal', link = false}))
end},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.api.nvim_create_autocmd('InsertEnter', {callback = function()
vim.print(vim.g.colors_name, vim.api.nvim_get_hl(0, {name = 'Normal', link = false}))
end}) Output of |
You mean the the colors are different when the build is ran during startup? Then yes, that's normal |
What's the actual problem you're trying to fix here? Why do you even load a colorscheme in a build function? Check the readme for colorscheme. You need to pay special attention it's loaded at the correct time, to prevent issues with plugins that dont properly use ColorScheme |
Weirdly, it's only the How can it be prevented? It's preventing with two things: |
lazy doesn't change the colors. The lazy build thing just loads the plugin and runs the build function. updated repro: -- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
local test = {}
local function t(msg)
test[#test + 1] = { msg, vim.g.colors_name, vim.api.nvim_get_hl(0, { name = "Normal", link = false }) }
end
t("before_lazy")
-- install plugins
local plugins = {
{
"folke/tokyonight.nvim",
build = function()
t("start_build")
vim.cmd.colorscheme("tokyonight")
t("end_build")
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
t("after_lazy")
vim.defer_fn(function()
vim.cmd([[:Lazy build tokyonight.nvim]])
end, 1000)
vim.defer_fn(function()
t("after_defer")
for _, tt in ipairs(test) do
print(vim.inspect(tt))
end
end, 2000) |
The problem is probably that your build function runs before Neovim loaded the default colorscheme |
This repro also bugs when doing Edit: actually, all of those screenshots you posted had the wrong bg for |
The thing is that it doesn't for me. What NEovim version are you using? 100% certain this is user error. I'm sure you'll figure it out. |
I'm using Neovim 0.9.0, but it also happens on recent nightly builds. I can try it on another machine later just to make sure it's not something in my environment messing it up. Feel free to ignore until then |
I've spent too much time on this already as is. I'm not going to debug your config or your plugins. This is not a lazy issue. It might be related to |
For anyone who comes across this issue, I tried it on another machine. Wiped it clean, fresh install of Windows (my normal machine is Linux). Downloaded Neovim 0.9.0 right from Github, no alternative distribution. Checked the hashes to make sure they matched (i.e. no download issues). Followed the instructions in this comment and got the same result. Tried multiple different terminals (powershell and cmd), same result.
|
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.0
Operating system/version
6.2.12-arch1-1
Describe the bug
It seems the color of
Normal
is modified temporarily after executing:Lazy build
. For example:Normal
's background color is"#202020"
. During:Lazy build
, it is"#353535"
Normal
is cleared. During:Lazy build
, the background"#ff00ff"
Steps To Reproduce
build
hook to any plugin, e.g.:nvim
, then run:hi Normal
to verify the correctNormal
highlight color.:Lazy build <plugin>
, it will print an incorrectNormal
color first then 5 seconds later it will print the correct one.Expected Behavior
The
Normal
highlight group should remain unmodified while running:Lazy build
, so that colorscheme plugins (e.g.mini.colors
) can run update hooks.Repro
The text was updated successfully, but these errors were encountered: