Skip to content
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: lazy window backdrop doesn't disappear when closing in plugin setup #1390

Closed
3 tasks done
aarondill opened this issue Mar 27, 2024 · 1 comment · Fixed by #1388
Closed
3 tasks done

bug: lazy window backdrop doesn't disappear when closing in plugin setup #1390

aarondill opened this issue Mar 27, 2024 · 1 comment · Fixed by #1388
Labels
bug Something isn't working

Comments

@aarondill
Copy link

aarondill commented Mar 27, 2024

Did you check docs and existing issues?

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

Neovim version (nvim -v)

NVIM v0.10.0-dev-2702+g0c0be09ea-dirty

Operating system/version

Arch Linux

Describe the bug

On startup, Lazy opens when plugins are missing.
I have a plugin spec (for dashboard-nvim) which closes the window if it's open.
It doesn't clear the backdrop when closing.

Steps To Reproduce

  1. nvim -nu repro.lua
  2. Clean nvim-treesitter (any plugin) (the repro does this for you)
  3. Open nvim
  4. Wait for it to install
  5. Notice darkened editor

Expected Behavior

Remove the backdrop on close

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)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "nvim-treesitter/nvim-treesitter" }, -- Any plugin works, just need something to cause lazy to open
  {
    "echasnovski/mini.animate", -- any plugin, just using for `event =`
    event = "VimEnter", -- This doesn't work as a normal autocmd. I don't know why.
    opts = function()
      if vim.o.filetype == "lazy" then
        vim.cmd.close()
      end
    end,
  },
}
require("lazy").setup(plugins, { install = { colorscheme = { "tokyonight-night" } } }) -- It's more obvious with tokyonight
require("lazy").clean({ plugins = { "nvim-treesitter" }, show = false }) -- Make repro easier by making this idempotent
@aarondill aarondill added the bug Something isn't working label Mar 27, 2024
@aarondill aarondill changed the title bug: lazy window backdrop doesn't disappear on install = {missing=true} bug: lazy window backdrop doesn't disappear when closing in plugin setup Mar 27, 2024
@folke folke closed this as completed in eefb897 Mar 27, 2024
@folke
Copy link
Owner

folke commented Mar 27, 2024

Should be fixed now.

It seems that Neovim does not execute WinClosed autocmds before VimEnter.
Added an extra check on VimEnter to see if the window was already closed for cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants