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: lazy tries to load plugins that aren't installed #201

Closed
3 tasks done
LostNeophyte opened this issue Dec 28, 2022 · 0 comments · Fixed by #197
Closed
3 tasks done

bug: lazy tries to load plugins that aren't installed #201

LostNeophyte opened this issue Dec 28, 2022 · 0 comments · Fixed by #197
Labels
bug Something isn't working

Comments

@LostNeophyte
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)

NVIM v0.9.0-dev+519-g2d8bbe468

Operating system/version

Fedora 36

Describe the bug

lazy tries to load plugins that aren't installed (when automatic installation is disabled or there's no internet)

Steps To Reproduce

  1. nvim -u repro.lua
  2.  Failed to run `config` for which-key.nvim                                                                                                                                                                                                       
     /tmp/repro.lua:30: module 'which-key' not found:
    

Expected Behavior

no errors, config function should not be called when the plugin is not installed

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",
  {
    "folke/which-key.nvim",
    -- should not be called when the plugin is not installed
    config = function()
      require("which-key")
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
  install = {
    missing = false,
  },
})

vim.cmd.colorscheme("habamax")
pcall(function()
  vim.cmd.colorscheme("tokyonight")
end)
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
1 participant