feat!: plugins are now autmatically loaded on require. module= no longer needed!

This commit is contained in:
Folke Lemaitre 2022-12-02 09:22:15 +01:00
parent 0b6dec46e0
commit 575421b3fb
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
4 changed files with 84 additions and 52 deletions

View file

@ -38,7 +38,7 @@ function M.try(fn, msg)
if not info then
break
end
if info.what == "Lua" and not info.source:find("lazy.nvim") then
if info.what ~= "C" and not info.source:find("lazy.nvim") then
local source = info.source:sub(2)
if source:find(Config.root, 1, true) == 1 then
source = source:sub(#Config.root + 1)
@ -67,6 +67,20 @@ function M.try(fn, msg)
return ok and result or nil
end
function M.get_source()
local f = 2
while true do
local info = debug.getinfo(f, "S")
if not info then
break
end
if info.what ~= "C" and not info.source:find("lazy.nvim", 1, true) then
return info.source:sub(2)
end
f = f + 1
end
end
-- Fast implementation to check if a table is a list
---@param t table
function M.is_list(t)