folke / lazy.nvim

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

Lazy is not so forgiving of duplicate dependencies #113

Closed airtonix closed 1 year ago

airtonix commented 1 year ago

Describe the bug related to #53

When i drop in ~/.config/nvim/lua/plugins/ui_icons.lua :

return {
    'nvim-tree/nvim-web-devicons',
    url = 'https://github.com/nvim-tree/nvim-web-devicons',
}

I get this error on startup:

# Config Change Detected. Reloading...

- **added**: `.config/nvim/lua//plugins/ui_icons.lua`
Press ENTER or type command to continue
Merging plugins is not supported for key `1`
{
  new = { "kyazdani42/nvim-web-devicons",
    _ = {
      dep = true
    },
    dir = "/home/zenobius/.local/share/nvim/lazy/nvim-web-devicons",
    lazy = true,
    name = "nvim-web-devicons",
    url = "https://github.com/kyazdani42/nvim-web-devicons.git"
  },
  old = { "nvim-tree/nvim-web-devicons",
    _ = {},
    dir = "/home/zenobius/.local/share/nvim/lazy/nvim-web-devicons",
    name = "nvim-web-devicons",
    url = "https://github.com/nvim-tree/nvim-web-devicons"
  }
Press ENTER or type command to continue

Which version of Neovim are you using?

Terminal only.

> asdf current neovim
neovim          0.8.1           /home/zenobius/.tool-versions

> asdf which nvim
/home/zenobius/.asdf/installs/neovim/0.8.1/bin/nvim

> nvim --version

NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az178-366

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

To Reproduce Make sure to read https://github.com/folke/lazy.nvim/wiki/Minimal-%60init.lua%60-to-Reproduce-an-Issue

Steps to reproduce the behavior:

  1. use https://github.com/airtonix/lazy-nvim-duplicate-deps-bug as the config
  2. see confusing error throw about not being able to merge things ???

Expected Behavior

be more forgiving about duplicate dependencies:

Screenshots If applicable, add screenshots to help explain your problem.

repro.lua ```lua 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 = { -- do not remove the colorscheme! "folke/tokyonight.nvim", -- add any other pugins here { -- File Tree "nvim-neo-tree/neo-tree.nvim", dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", 'nvim-tree/nvim-web-devicons', }, keys = { { '', ':Neotree filesystem reveal left toggle', 'i', desc = 'Neotree' }, { '', ':Neotree filesystem reveal left toggle', 'n', desc = 'Neotree' }, }, config = function() require('neo-tree').setup({ popup_border_style = "rounded", enable_git_status = true, enable_diagnostics = true, default_component_configs = { git_status = { symbols = { -- Change type added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name modified = "m", -- or "", but this is redundant info if you use git_status_colors on the name deleted = "d", -- this can only be used in the git_status source renamed = "r", -- this can only be used in the git_status source -- Status type untracked = "u", ignored = "i", unstaged = "", staged = "✅", conflict = "", } }, }, filesystem = { filtered_items = { hide_dotfiles = true, hide_gitignored = true, } } }) end }, { -- Statusline 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', }, config = function() require('lualine').setup({ options = { icons_enabled = true, theme = 'auto', component_separators = { left = '', right = '' }, section_separators = { left = '', right = '' }, disabled_filetypes = { statusline = {}, winbar = {}, }, ignore_focus = {}, always_divide_middle = true, globalstatus = false, refresh = { statusline = 1000, tabline = 1000, winbar = 1000, } }, sections = { lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff', 'diagnostics' }, lualine_c = { 'filename' }, lualine_x = { 'encoding', 'fileformat', 'filetype' }, lualine_y = { 'progress' }, lualine_z = { 'location' } }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_c = { 'filename' }, lualine_x = { 'location' }, lualine_y = {}, lualine_z = {} }, tabline = {}, winbar = {}, inactive_winbar = {}, extensions = {} }) end }, { -- Tab bar 'noib3/nvim-cokeline', dependencies = { 'nvim-tree/nvim-web-devicons', }, config = function() local get_hex = require('cokeline/utils').get_hex local cokeline = require('cokeline') cokeline.setup({ show_if_buffers_are_at_least = 1, mappings = { cycle_prev_next = true, }, default_hl = { fg = function(buffer) -- return buffer.is_focused and colors.purple or colors.gray end, bg = "NONE", style = function(buffer) return buffer.is_focused and "bold" or nil end, }, sidebar = { filetype = 'neo-tree', components = { { text = 'Files', -- fg = yellow, bg = get_hex('NvimTreeNormal', 'bg'), style = 'bold', }, } }, components = { { text = " " }, { text = function(buffer) return buffer.unique_prefix or " " end, style = "italic", }, { text = function(buffer) return buffer.filename end, style = function(buffer) return buffer.is_focused and "bold" or nil end, }, { text = " " }, { text = function(buffer) return buffer.is_modified and "●" or " " end, fg = function(buffer) -- return buffer.is_focused and colors.red end, }, { text = " " }, { text = '', delete_buffer_on_left_click = true, }, { text = " " }, }, }) end } } require("lazy").setup(plugins, { root = root .. "/plugins", }) -- add anything else here vim.opt.termguicolors = true -- do not remove the colorscheme! vim.cmd([[colorscheme tokyonight]]) ```

Log Please include any related errors from the Noice log file. (open with :Lazy log)

Lazy log

folke commented 1 year ago

read the error message? You specify a plugin with two different names

folke commented 1 year ago

"kyazdani42/nvim-web-devicons" "nvim-tree/nvim-web-devicons"

airtonix commented 1 year ago

Sorry i'm a vim noob.

this detail isn't obvious to new comers, and this never happened with packer.

airtonix commented 1 year ago

I would expect that these are two different plugins:

"kyazdani42/nvim-web-devicons"
"nvim-tree/nvim-web-devicons"
folke commented 1 year ago

the plugin got renamed at some point.

It didnt happen with Packer, because Packer didnt check for this. Lazy does and correctlt shows an error message with the exact reason why this can not be merged

insorker commented 1 year ago

I got the same problem in "nvim-lualine/lualine.nvim" plugin configuration, and fixed it by changing "kyazdani42/nvim-web-devicons" to "nvim-tree/nvim-web-devicons", since they are the same repository.