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

Question/bug (?) regarding structuring plugins and the plugins directory #53

Closed
farzadmf opened this issue Dec 21, 2022 · 0 comments · Fixed by #55
Closed

Question/bug (?) regarding structuring plugins and the plugins directory #53

farzadmf opened this issue Dec 21, 2022 · 0 comments · Fixed by #55
Labels
bug Something isn't working

Comments

@farzadmf
Copy link

Describe the bug
Quoting the README:

Example:

  • ~/.config/nvim/init.lua
require("lazy").setup("plugins")
  • ~/.config/nvim/lua/plugins.lua or ~/.config/nvim/lua/plugins/init.lua
return {
  "folke/neodev.nvim",
    "folke/which-key.nvim",
    { "folke/neoconf.nvim", cmd = "Neoconf" },
}
  • any lua file in ~/.config/nvim/lua/plugins/*.lua will be automatically merged in the main plugin spec

My question is: is step 2 (having plugins.lua or plugins/init.lua) necessary for step 3 (so that every plugins/*.lua file loads automatically)?

That seems to be the case because lazy is complaining that it cannot read .../plugins/init.lua.

Was wondering if this is a bug or intended behavior.

Which version of Neovim are you using?
Version 0.8.1

To Reproduce

  1. Create ~/.config/nvim/init.lua:
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)

local lazy = require('lazy')

lazy.setup('plugins')
  1. And create ~/.config/nvim/lua/plugins/my.lua:
return {
  'nvim-tree/nvim-web-devicons',
  url = 'https://github.com/nvim-tree/nvim-web-devicons',
}
  1. Open nvim, and there will be an error saying:
Failed to load **plugins**
....local/share/nvim/lazy/lazy.nvim/lua/lazy/core/cache.lua:105: cannot open /Users/farzadmf/.config/nvim/l
ua/plugins/init.lua: No such file or directory

Expected Behavior
Since I'm using those individual files to separate my plugins, it doesn't make much sense to me to have the init.lua file in there

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

Log
:Lazy log shows:

Lazy log
Failed to load **plugins**
....local/share/nvim/lazy/lazy.nvim/lua/lazy/core/cache.lua:105: cannot open /Users/farzadmf/.config/nvim/l
ua/plugins/init.lua: No such file or directory
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.

1 participant