Files
dep/lua/dep/lazy/init.lua

38 lines
1.1 KiB
Lua

local h = require("dep.helpers")
local packager = require("dep.package")
---@class lazy
local lazy = {}
-- since this is already a ridiculous "optimization" we should really be caching
-- the results of this for when the user keeps on loading the colorscheme that
-- they've lazy loaded, that way we speed up the lazy loading process
local function colorscheme()
-- if a colorscheme doesn't exist attempt load it prior to it being set
vim.api.nvim_create_autocmd("ColorschemePre", {
pattern = vim.fn.getcompletion("", "color"),
callback = function(e)
for _, p in pairs(packager.get_packages()) do
if not p.loaded then
for _, ext in ipairs({ ".lua", ".vim" }) do
local path = p.dir.."/colors/"..e.match..ext
if h.uv.fs_stat(path) then
p:ensureadded(true)
-- break out of here, we've loaded the colorscheme
return
end
end
end
end
end
})
end
--- setup all lazy handlers
function lazy.setup()
-- start the colorscheme watcher
colorscheme()
end
return lazy