2022-11-22 20:28:08 +00:00
|
|
|
local Util = require("lazy.core.util")
|
2022-11-20 21:33:47 +00:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
---@class LazyConfig
|
|
|
|
M.defaults = {
|
2022-11-20 21:34:55 +00:00
|
|
|
opt = true,
|
2022-11-21 20:50:16 +00:00
|
|
|
plugins = "config.plugins",
|
2022-11-20 21:34:55 +00:00
|
|
|
plugins_local = {
|
|
|
|
path = vim.fn.expand("~/projects"),
|
2022-11-24 21:04:23 +00:00
|
|
|
---@type string[]
|
2022-11-21 20:50:16 +00:00
|
|
|
patterns = {},
|
2022-11-20 21:34:55 +00:00
|
|
|
},
|
2022-11-25 14:35:40 +00:00
|
|
|
interactive = true,
|
2022-11-28 23:14:23 +00:00
|
|
|
packpath = vim.fn.stdpath("data") .. "/site/pack/lazy",
|
2022-11-28 23:15:13 +00:00
|
|
|
lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json",
|
2022-11-23 18:06:04 +00:00
|
|
|
view = {
|
|
|
|
icons = {
|
|
|
|
start = "",
|
2022-11-29 11:02:25 +00:00
|
|
|
plugin = " ",
|
2022-11-23 18:06:04 +00:00
|
|
|
source = " ",
|
|
|
|
config = "",
|
|
|
|
event = "",
|
|
|
|
keys = " ",
|
|
|
|
cmd = " ",
|
|
|
|
ft = "",
|
2022-11-28 23:15:13 +00:00
|
|
|
task = "✔ ",
|
2022-11-23 18:06:04 +00:00
|
|
|
},
|
|
|
|
},
|
2022-11-29 22:16:21 +00:00
|
|
|
install_missing = true,
|
2022-11-29 14:25:09 +00:00
|
|
|
git = {
|
|
|
|
-- defaults for `Lazy log`
|
|
|
|
log = { "-10" }, -- last 10 commits
|
|
|
|
-- log = { "--since=3 days ago" }, -- commits from the last 3 days
|
|
|
|
},
|
2022-11-20 21:33:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
M.ns = vim.api.nvim_create_namespace("lazy")
|
|
|
|
|
2022-11-24 21:04:23 +00:00
|
|
|
M.paths = {
|
|
|
|
---@type string
|
|
|
|
main = nil,
|
|
|
|
---@type string
|
|
|
|
plugins = nil,
|
|
|
|
}
|
|
|
|
|
2022-11-20 21:33:47 +00:00
|
|
|
---@type table<string, LazyPlugin>
|
|
|
|
M.plugins = {}
|
|
|
|
|
2022-11-24 21:04:23 +00:00
|
|
|
---@type LazyPlugin[]
|
|
|
|
M.to_clean = {}
|
|
|
|
|
2022-11-20 21:33:47 +00:00
|
|
|
---@type LazyConfig
|
|
|
|
M.options = {}
|
|
|
|
|
|
|
|
---@param opts? LazyConfig
|
|
|
|
function M.setup(opts)
|
2022-11-20 21:34:55 +00:00
|
|
|
M.options = vim.tbl_deep_extend("force", M.defaults, opts or {})
|
2022-11-24 21:04:23 +00: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-20 21:33:47 +00:00
|
|
|
|
2022-11-25 21:49:41 +00:00
|
|
|
-- TODO: check what this does inside a GUI. Probably still ok
|
|
|
|
if #vim.api.nvim_list_uis() == 0 then
|
|
|
|
M.options.interactive = false
|
|
|
|
end
|
2022-11-20 21:33:47 +00:00
|
|
|
|
2022-11-20 21:34:55 +00:00
|
|
|
vim.api.nvim_create_autocmd("User", {
|
|
|
|
pattern = "VeryLazy",
|
|
|
|
once = true,
|
|
|
|
callback = function()
|
2022-11-30 13:19:50 +00:00
|
|
|
require("lazy.core.module").autosave()
|
2022-11-20 22:25:56 +00:00
|
|
|
require("lazy.view").setup()
|
2022-11-20 21:34:55 +00:00
|
|
|
end,
|
|
|
|
})
|
2022-11-20 21:33:47 +00:00
|
|
|
|
2022-11-20 21:34:55 +00:00
|
|
|
Util.very_lazy()
|
2022-11-20 21:33:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|