lazy.nvim icon indicating copy to clipboard operation
lazy.nvim copied to clipboard

bug: default colorscheme is overriden by Lazy

Open famiu opened this issue 10 months ago • 3 comments

Did you check docs and existing issues?

  • [X] I have read all the lazy.nvim docs
  • [X] I have searched the existing issues of lazy.nvim
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-2914+g4ec8fd43b

Operating system/version

Fedora Linux 39

Describe the bug

When using the default colorscheme, if Lazy installs a new plugin, the default colorscheme is overriden

Steps To Reproduce

  1. Don't use a colorscheme
  2. Add a new plugin
  3. Restart Neovim

Expected Behavior

  1. Lazy.nvim installs the plugins without changing the default colorscheme

Even in the lazy config, if I use install.colorscheme = {} or install.colorscheme = { 'default' }, it still uses the vim colorscheme instead of default, for some reason

Repro

-- DO NOT change the paths and don't remove the colorscheme
-- This comment is N/A for this issue since the colorscheme IS relevant to the issue itself.
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 = {
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

famiu avatar Apr 16 '24 13:04 famiu

Lazy does not override the colorscheme at all when set to default. I just did some testing and it seems that Neovim's new default colorscheme highlights are loaded right before VimEnter, so the default colors before that are simply incorrect.

Nothing lazy can do about this.

Relevant code is:

  • init_highlight in main.c

Even explicly calling colorscheme default doesn't work as long as init_highlight wasn't called.

folke avatar Apr 22 '24 08:04 folke

Maybe load the Lazy installation UI after VimEnter? Would that be an option?

famiu avatar Apr 22 '24 21:04 famiu

no, since plugins might depend on VimEnter. Also, loading any other colorscheme works fine. Builtin or external ones.

It's just the default colorscheme that won't load, so this is really an issue that should be fixed in Neovim.

folke avatar Apr 23 '24 06:04 folke

I encountered the same (or similar) issue. When the bug occurs, the colorscheme is incorrectly set to habamax.

vhakulinen avatar May 27 '24 20:05 vhakulinen

Closing since this is an upstream issue

folke avatar Jun 24 '24 05:06 folke