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: Using url to specify plugin results in error, version 9.3.1 #421

Closed
3 tasks done
smhc opened this issue Jan 18, 2023 · 4 comments · Fixed by #417
Closed
3 tasks done

bug: Using url to specify plugin results in error, version 9.3.1 #421

smhc opened this issue Jan 18, 2023 · 4 comments · Fixed by #417
Labels
bug Something isn't working

Comments

@smhc
Copy link

smhc commented Jan 18, 2023

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 exsiting issues of plugins related to this issue

Neovim version (nvim -v)

0.8.0

Operating system/version

Linux

Describe the bug

Specifying a plugin using 'url' syntax results in the error:

Error detected while processing /xx/repro.lua:
Plugin spec for gruvbox-material not found.

{ "gruvbox",
  _ = {},
  dir = "/x/.repro/plugins/gruvbox-material",
  name = "gruvbox-material",
  url = "https://github.com/sainnhe/gruvbox-material.git"
}

Steps To Reproduce

See repro.lua

Expected Behavior

Behaviour should match lazy.nvim 9.3.0 - no error.

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",
  {
    "gruvbox",
    url = "https://github.com/sainnhe/gruvbox-material.git"
  }
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@smhc smhc added the bug Something isn't working label Jan 18, 2023
@max397574
Copy link
Contributor

max397574 commented Jan 18, 2023

it works if you remove the gruvbox

  {
    url = "https://github.com/sainnhe/gruvbox-material.git"
  }

I also couldn't find anything that looks like what you did in the docs
so ig you should do it like I did

@smhc
Copy link
Author

smhc commented Jan 18, 2023

Thanks - for some reason I interpreted that first string as being used as the short plugin name if the full URL is provided to override the derived URL. Perhaps it's because Packer uses the one [1] item for both full urls and short urls and so I had the misconception it was mandatory. When converting from a packer config I added the url key and left the 'short url' item.

I suppose the error message could be improved and misconfiguration better detected, but this is quite a minor issue. Maybe one of the examples could use a vanilla url type spec if I were to be pedantic.

@folke
Copy link
Owner

folke commented Jan 18, 2023

gruvbox is an incorrect short url. But I'll fix it anyway.

@smhc
Copy link
Author

smhc commented Jan 18, 2023

@folke my thinking was it would be ignored because the full URL was provided (my actual URL is not a github url). It's my mistake for thinking the 'short url' was a combo name/short-url. So even if the short url was valid the actual error is that both url and short-url were specified.

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.

3 participants