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: Error while calling lua chunk #160

Closed
3 tasks done
JayMGurav opened this issue Dec 25, 2022 · 5 comments · Fixed by #166
Closed
3 tasks done

bug: Error while calling lua chunk #160

JayMGurav opened this issue Dec 25, 2022 · 5 comments · Fixed by #166
Labels
bug Something isn't working

Comments

@JayMGurav
Copy link

Did you check docs and existing issues?

  • I have read all the lazy docs
  • I have searched the existing issues of lazy
  • I have searched the exsiting issues of the plugin I have a problem with

Neovim version (nvim -v)

v0.8.0

Operating system/version

MacOs (12.6.1)

Describe the bug

image

My ...nvim/lua/jay/lazy.lua file is as below

----------------------------------------------------
-- Bootstrap lazy
-----------------------------------------------------
 local lazypath = vim.fn.stdpath("data") .. "/lazy/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)
----------------------------------------------------

require("lazy").setup("jay.plugins", {
  install = { colorscheme = { "horizon", "doom-one.nvim" } },
  performance = {
    rtp = {
      disabled_plugins = {
        "gzip",
        "matchit",
        "matchparen",
        "netrwPlugin",
        "tarPlugin",
        "tohtml",
        "tutor",
        "zipPlugin",
      },
    },
  },
  debug = true,
})

jay.nnoremap("<leader>l", "<cmd>:Lazy<cr>")

While jay.plugins dir contains all the plugins as mentioned in Structuring your plugins

Steps To Reproduce

  1. require above lua/jay/lazy.lua file in nvim/init.lua

Expected Behavior

should work as expected without any errors

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

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other pugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@JayMGurav JayMGurav added the bug Something isn't working label Dec 25, 2022
@JayMGurav
Copy link
Author

JayMGurav commented Dec 25, 2022

the Repro code worked as expected though, I don't understand what's the issue with my setup

@max397574
Copy link
Contributor

you should modify the repro so that the bug exists with it

@folke
Copy link
Owner

folke commented Dec 25, 2022

I can prevent that error, but that would mask the problem. The issue is probably that you have a dependency specified somewhere with a plugin name that does not exist. So you have a plugin name in a dep without a forward slash and that plugin does not exist.

I'll add a proper error message for this, so it will be easier to see what's wrong

@folke folke closed this as completed in 9095223 Dec 25, 2022
@folke
Copy link
Owner

folke commented Dec 25, 2022

I've added a clear error if what I think is happening here is happening. Let me know if you still can't resolve the issue

@JayMGurav
Copy link
Author

yea, this was issue, but the error was persisting even after add appropriate plugin name. So I had to start fresh again with the first plugin. Thanks! for adding clear error msgs, it gives better visibility of the issue.

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