lazy.nvim/lua/lazy/core/config.lua

78 lines
1.8 KiB
Lua
Raw Normal View History

local Util = require("lazy.core.util")
2022-11-21 05:33:47 +08:00
local M = {}
---@class LazyConfig
M.defaults = {
plugins = "config.plugins",
defaults = {
opt = false, -- should plugins default to "opt" or "start"
version = nil,
-- version = "*", -- enable this to try installing the latest stable versions of plugins
},
2022-12-01 06:08:00 +08:00
dev = {
path = vim.fn.expand("~/projects"), -- the path where you store your projects
---@type string[]
2022-12-01 06:08:00 +08:00
patterns = {}, -- For example {"folke"}
2022-11-21 05:34:55 +08:00
},
packpath = vim.fn.stdpath("data") .. "/site/pack/lazy",
2022-11-29 07:15:13 +08:00
lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json",
2022-11-24 02:06:04 +08:00
view = {
icons = {
start = "",
2022-11-29 19:02:25 +08:00
plugin = "",
2022-11-24 02:06:04 +08:00
source = "",
config = "",
event = "",
keys = "",
cmd = "",
ft = "",
2022-11-29 07:15:13 +08:00
task = "",
2022-11-24 02:06:04 +08:00
},
},
2022-11-30 06:16:21 +08:00
install_missing = true,
2022-11-29 22:25:09 +08:00
git = {
-- defaults for `Lazy log`
log = { "-10" }, -- last 10 commits
-- log = { "--since=3 days ago" }, -- commits from the last 3 days
},
2022-11-21 05:33:47 +08:00
}
M.ns = vim.api.nvim_create_namespace("lazy")
M.paths = {
---@type string
main = nil,
---@type string
plugins = nil,
}
2022-11-21 05:33:47 +08:00
---@type table<string, LazyPlugin>
M.plugins = {}
---@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 {})
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-21 05:34:55 +08:00
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
once = true,
callback = function()
require("lazy.core.module").autosave()
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