folke / lazy.nvim

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

Sub modules not loading #66

Closed B4rc1 closed 1 year ago

B4rc1 commented 1 year ago

Hey, I tried migrating from packer to lazy. My current plugin structure is this.

In my init.lua i specify:

require("lazy").setup("plugins", { defaults = { version = "*" } })

The readme tells me:

any lua file in ~/.config/nvim/lua/plugins/*.lua will be automatically merged in the main plugin spec

But currently only the ~/.config/nvim/lua/plugins/init.lua file gets sourced and plugins installed from it. For example my fuzzy finder is neither loaded nor installed: :lua require('fzf-lua').files():

E5108: Error executing lua [string ":lua"]:1: module 'fzf-lua' not found:
        no field package.preload['fzf-lua']
        no file '/nix/store/w08dyn0iamcixgc6cgv9ma8sq165vlvq-luajit-2.1.0-2022-10-04-env/share/lua/5.1/fzf-lua.lua'
        no file '/nix/store/w08dyn0iamcixgc6cgv9ma8sq165vlvq-luajit-2.1.0-2022-10-04-env/share/lua/5.1/fzf-lua/init.lua'
        no file '/nix/store/w08dyn0iamcixgc6cgv9ma8sq165vlvq-luajit-2.1.0-2022-10-04-env/lib/lua/5.1/fzf-lua.so'fzf-lua not found in lazy plugin
s
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:1: in main chunk

What am I missing?

folke commented 1 year ago

I see you're using Nix. Might be related to that. What gets printed if you execute the code below?

local Util = require("lazy.core.util")
Util.lsmod("plugins", function(modname, modpath)
  print(modname .. ": " .. modpath)
end)
folke commented 1 year ago

Is there anything else special about your Nix env I should know? Lazy resets the rtp, so that might cause issues with Nix somehow. Try setting config.performane.rtp.reset = false

B4rc1 commented 1 year ago

What gets printed if you execute the code below?

Nothing at all gets printed?! I tried inserting it into a file and running :so %, entering it into commandline like :lua require("lazy.core.util").lsmod("plugins", function(modname, modpath) print(modname .. ": " .. modpath) end) and inserting it into my init.lua

Is there anything else special about your Nix env I should know?

All my neovim config files are symlinks into the nix store (only the files, not the folders):

❯ ls -la .config/nvim
drwxr-xr-x    - jonas 21 Dez 16:14  ftplugin
drwxr-xr-x    - jonas 21 Dez 16:14  lua
lrwxrwxrwx   86 jonas 21 Dez 16:14  .gitignore -> /nix/store/3jwb4cc4r0yqgsyw16c611z03ssalrpw-home-manager-files/.config/nvim/.gitignore
lrwxrwxrwx   84 jonas 21 Dez 16:14  init.lua -> /nix/store/3jwb4cc4r0yqgsyw16c611z03ssalrpw-home-manager-files/.config/nvim/init.lua
.rw-r--r-- 4,2k jonas 21 Dez 13:37  lazy-lock.json

This also means, that all files are readonly from neovims perspective.

And I generate some paths to lspservers in nix and source them in neovim, this sould however not matter here.

Try setting config.performane.rtp.reset = false

Did not change a thing. Same problem

folke commented 1 year ago

gotcha. It's because they are links instead of files. Will change it so it works for links too