|
Hey, I'm currently moving over some plugins, and I want to group them all under a folder like the example structure Currently im importing the entire lazy directory with |
Replies: 1 comment
|
So, You can put it in an import spec, or just pass it straight to lze.load In that list of specs, it will create 1 import spec for each It will also make an entry for each directory with an So, to import a subfolder, make the So, in the scenario where you do require("lze").load(require("lzextras").mod_dir_to_spec("lazy"))
return mod_dir_to_spec(..., function(name) return name ~= "init" end)(the first argument of modules which have been called via require is the name used to require it, hence the There are actually quite a few ways to do it, but that is one of them. Alternatively require("lze").load({
{ import = require("lzextras").mod_dir_to_spec("lazy", function(name) return name ~= "cmp" end)) },
{ import = require("lzextras").mod_dir_to_spec("lazy.cmp") }
})But, And Sorry, took me a few days to notice this one, I think I accidentally dismissed the notification for it or something. The relevant source code for these is actually quite self-contained and easy to read. Here is the parsing for the import spec in lze, in the file which defines the parse function it uses to normalize 1 or more specs to a list of specs with a name field, importing any import specs as it goes. Lines 11 to 60 in 7276233 And in https://github.com/BirdeeHub/lzextras/blob/master/lua/lzextras/src/mod_dir_to_spec.lua |
So,
require("lzextras").mod_dir_to_spec("lazy")will make a list of specs.You can put it in an import spec, or just pass it straight to lze.load
In that list of specs, it will create 1 import spec for each
*.luafile in thelua/lazydirectory.It will also make an entry for each directory with an
init.luain it.So, to import a subfolder, make the
lua/lazy/yourfolder/init.luareturn specs from another call tomod_dir_to_spec(and use its filter functionality to not include that"init"file in that list)So, in the scenario where you do
lua/lazy/cmp/init.luawould look like