Skip to content

bug: lazy.nvim always appears in Clean() on Windows even when installed correctly #2097

@fcying

Description

@fcying

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • 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)

0.11.5

Operating system/version

windows

Describe the bug

lazy.nvim always appears in Clean() on Windows even when installed correctly
local lazypath = g.runtime_dir .. "/plugins/lazy.nvim"

If lazy.nvim is not placed inside the plugin root local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
lazy.nvim does NOT appear in the Clean() list, but cannot update itself via :Lazy update
Due to this issue, automatic background updates on Windows do not work.nvim --headless '+Lazy! sync' +qa"

nvim -u init.lua
Windows:
Image

Linux:

Image

Steps To Reproduce

  1. nvim -u init.lua
  2. :Lazy

Expected Behavior

The behavior should be consistent between Windows and Linux:

Repro

local g, fn = vim.g, vim.fn
vim.g.mapleader = " "

g.config_dir = fn.fnamemodify(fn.resolve(fn.expand("<sfile>:p")), ":h")
g.runtime_dir = g.config_dir .. "/.repro"
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = g.runtime_dir .. "/" .. name
end

-- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
local lazypath = g.runtime_dir .. "/plugins/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

vim.opt.termguicolors = true
local plugins = {
    { "maxmx03/solarized.nvim" },
}

require("lazy").setup(plugins, {
    root = g.runtime_dir .. "/plugins",
})
vim.opt.background = "light"
vim.cmd.colorscheme("solarized")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions