2022-11-23 04:28:08 +08:00
|
|
|
local Util = require("lazy.core.util")
|
2022-11-21 05:33:47 +08:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
---@class LazyConfig
|
|
|
|
M.defaults = {
|
2022-11-21 05:34:55 +08:00
|
|
|
opt = true,
|
2022-11-22 04:50:16 +08:00
|
|
|
plugins = "config.plugins",
|
2022-11-21 05:34:55 +08:00
|
|
|
plugins_local = {
|
|
|
|
path = vim.fn.expand("~/projects"),
|
2022-11-25 05:04:23 +08:00
|
|
|
---@type string[]
|
2022-11-22 04:50:16 +08:00
|
|
|
patterns = {},
|
2022-11-21 05:34:55 +08:00
|
|
|
},
|
2022-11-25 22:35:40 +08:00
|
|
|
interactive = true,
|
2022-11-21 05:34:55 +08:00
|
|
|
package_path = vim.fn.stdpath("data") .. "/site/pack/lazy",
|
2022-11-24 02:06:04 +08:00
|
|
|
view = {
|
|
|
|
icons = {
|
|
|
|
start = "",
|
|
|
|
plugin = "",
|
|
|
|
source = " ",
|
|
|
|
config = "",
|
|
|
|
event = "",
|
|
|
|
keys = " ",
|
|
|
|
cmd = " ",
|
|
|
|
ft = "",
|
|
|
|
},
|
|
|
|
},
|
2022-11-21 05:33:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
M.ns = vim.api.nvim_create_namespace("lazy")
|
|
|
|
|
2022-11-25 05:04:23 +08:00
|
|
|
M.paths = {
|
|
|
|
---@type string
|
|
|
|
main = nil,
|
|
|
|
---@type string
|
|
|
|
plugins = nil,
|
|
|
|
}
|
|
|
|
|
2022-11-21 05:33:47 +08:00
|
|
|
---@type table<string, LazyPlugin>
|
|
|
|
M.plugins = {}
|
|
|
|
|
2022-11-25 05:04:23 +08:00
|
|
|
---@type LazyPlugin[]
|
|
|
|
M.to_clean = {}
|
|
|
|
|
2022-11-21 05:33:47 +08:00
|
|
|
---@type LazyConfig
|
|
|
|
M.options = {}
|
|
|
|
|
|
|
|
---@param opts? LazyConfig
|
|
|
|
function M.setup(opts)
|
2022-11-21 05:34:55 +08:00
|
|
|
M.options = vim.tbl_deep_extend("force", M.defaults, opts or {})
|
2022-11-25 05:04:23 +08:00
|
|
|
M.paths.plugins = vim.fn.stdpath("config") .. "/lua/" .. M.options.plugins:gsub("%.", "/")
|
|
|
|
M.paths.main = M.paths.plugins .. (vim.loop.fs_stat(M.paths.plugins .. ".lua") and ".lua" or "/init.lua")
|
2022-11-21 05:33:47 +08:00
|
|
|
|
2022-11-22 04:50:16 +08:00
|
|
|
-- vim.fn.mkdir(M.options.package_path, "p")
|
2022-11-21 05:33:47 +08:00
|
|
|
|
2022-11-21 05:34:55 +08:00
|
|
|
vim.api.nvim_create_autocmd("User", {
|
|
|
|
pattern = "VeryLazy",
|
|
|
|
once = true,
|
|
|
|
callback = function()
|
2022-11-21 06:25:56 +08:00
|
|
|
require("lazy.view").setup()
|
2022-11-21 05:34:55 +08:00
|
|
|
end,
|
|
|
|
})
|
2022-11-21 05:33:47 +08:00
|
|
|
|
2022-11-21 05:34:55 +08:00
|
|
|
Util.very_lazy()
|
2022-11-21 05:33:47 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|