folke / lazy.nvim

💤 A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
13.35k stars 320 forks source link

bug: Specifying `name` spec in `lazy.nvim` plugin configuration file causes it to clone the repo twice. #1631

Open johnsmith0x3f opened 3 weeks ago

johnsmith0x3f commented 3 weeks ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1716656478

Operating system/version

Arch Linux with Kernel 6.9.7

Describe the bug

After adding name = "Noise" in the installation file and running NeoVim, lazy.nvim clones the repo twice and stores it into two directories named "Noice" and "noice.nvim". Both of the plugins are loaded, while configurations like event = 'VeryLazy' are applied only to the former one.

Steps To Reproduce

  1. Simply add name = "Noise" to the configuration file.

Expected Behavior

lazy.nvim loads and only loads the plugin once with the name shown as "Noice".

Repro

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",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    name = "Noice", "folke/noice.nvim",
    event = "VeryLazy",
    dependencies = {
      "MunifTanjim/nui.nvim",
      "rcarriga/nvim-notify",
    },
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
vim.cmd([[colorscheme tokyonight]])
require("noice").setup()
folke commented 3 weeks ago

It will clone it again and the other one will be flagged for cleanup. That's how it's supposed to work

johnsmith0x3f commented 2 weeks ago

Sorry for the late reply. It seems that it didn't work like it's supposed to. My other plugins like the tokyonight colorscheme worked as desired, yet I have a noice.nvim placed under Loaded in the :Lazy list. Is there any other information I can provide?

folke commented 2 weeks ago

Moved to lazy. Will check in the coming days. Low prio

johnsmith0x3f commented 2 weeks ago

Thanks!