2022-11-23 04:28:08 +08:00
|
|
|
|
local Util = require("lazy.core.util")
|
2022-11-21 05:33:47 +08:00
|
|
|
|
|
2022-12-29 00:57:59 +08:00
|
|
|
|
---@class LazyCoreConfig
|
2022-11-21 05:33:47 +08:00
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
---@class LazyConfig
|
|
|
|
|
M.defaults = {
|
2022-12-03 22:48:06 +08:00
|
|
|
|
root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed
|
2022-12-01 06:08:40 +08:00
|
|
|
|
defaults = {
|
2024-06-24 13:12:32 +08:00
|
|
|
|
-- Set this to `true` to have all your plugins lazy-loaded by default.
|
2024-06-24 12:44:33 +08:00
|
|
|
|
-- Only do this if you know what you are doing, as it can lead to unexpected behavior.
|
2022-12-04 04:08:35 +08:00
|
|
|
|
lazy = false, -- should plugins be lazy-loaded?
|
2024-06-24 03:07:44 +08:00
|
|
|
|
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
|
|
|
|
-- have outdated releases, which may break your Neovim install.
|
|
|
|
|
version = nil, -- always use the latest git commit
|
|
|
|
|
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
2023-03-14 18:19:51 +08:00
|
|
|
|
-- default `cond` you can use to globally disable a lot of plugins
|
|
|
|
|
-- when running inside vscode for example
|
|
|
|
|
cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil
|
2022-12-01 06:08:40 +08:00
|
|
|
|
},
|
2023-01-02 16:44:09 +08:00
|
|
|
|
-- leave nil when passing the spec as the first argument to setup()
|
|
|
|
|
spec = nil, ---@type LazySpec
|
2024-05-26 22:43:52 +08:00
|
|
|
|
local_spec = true, -- load project specific .lazy.lua spec files. They will be added at the end of the spec.
|
2022-12-01 06:14:16 +08:00
|
|
|
|
lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update.
|
2024-03-27 02:52:16 +08:00
|
|
|
|
---@type number? limit the maximum amount of concurrent tasks
|
|
|
|
|
concurrency = jit.os:find("Windows") and (vim.uv.available_parallelism() * 2) or nil,
|
2022-12-01 06:14:16 +08:00
|
|
|
|
git = {
|
2022-12-15 04:03:53 +08:00
|
|
|
|
-- defaults for the `Lazy log` command
|
2023-10-14 23:14:45 +08:00
|
|
|
|
-- log = { "--since=3 days ago" }, -- show commits from the last 3 days
|
|
|
|
|
log = { "-8" }, -- show the last 8 commits
|
2022-12-15 04:03:53 +08:00
|
|
|
|
timeout = 120, -- kill processes that take more than 2 minutes
|
2022-12-13 17:09:33 +08:00
|
|
|
|
url_format = "https://github.com/%s.git",
|
2023-01-24 02:18:15 +08:00
|
|
|
|
-- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version,
|
2023-03-06 14:39:56 +08:00
|
|
|
|
-- then set the below to false. This should work, but is NOT supported and will
|
2023-01-24 02:18:15 +08:00
|
|
|
|
-- increase downloads a lot.
|
|
|
|
|
filter = true,
|
2022-12-01 06:14:16 +08:00
|
|
|
|
},
|
2024-06-19 03:54:54 +08:00
|
|
|
|
pkg = {
|
|
|
|
|
enabled = true,
|
|
|
|
|
cache = vim.fn.stdpath("state") .. "/lazy/pkg-cache.lua",
|
2024-06-23 16:28:51 +08:00
|
|
|
|
-- the first package source that is found for a plugin will be used.
|
2024-06-19 03:54:54 +08:00
|
|
|
|
sources = {
|
|
|
|
|
"lazy",
|
2024-06-25 01:44:07 +08:00
|
|
|
|
"rockspec", -- will only be used when rocks.enabled is true
|
2024-06-19 03:54:54 +08:00
|
|
|
|
"packspec",
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-06-19 01:39:47 +08:00
|
|
|
|
rocks = {
|
2024-06-25 01:44:07 +08:00
|
|
|
|
enabled = true,
|
2024-06-19 01:39:47 +08:00
|
|
|
|
root = vim.fn.stdpath("data") .. "/lazy-rocks",
|
2024-06-19 03:54:54 +08:00
|
|
|
|
server = "https://nvim-neorocks.github.io/rocks-binaries/",
|
2024-06-29 17:44:31 +08:00
|
|
|
|
-- use hererocks to install luarocks?
|
|
|
|
|
-- set to `nil` to use hererocks when luarocks is not found
|
|
|
|
|
-- set to `true` to always use hererocks
|
|
|
|
|
-- set to `false` to always use luarocks
|
|
|
|
|
hererocks = nil,
|
2024-06-19 01:39:47 +08:00
|
|
|
|
},
|
2022-12-01 06:08:00 +08:00
|
|
|
|
dev = {
|
feat(plugin): dev.path can now be a function (#1157)
In some case, `dev.path .. plugin.name` is not enoguh.
For example, when using `ghq` to manage projects, plugin directories may
vary by onewrs of the plugins.
With this change, users can do something like below
``` lua
require("lazy").setup("plugins", {
dev = {
path = function(p)
-- ghq
local path, cnt = string.gsub(p.url, "^https://(.*)%.git$", "~/ghq/%1")
if cnt == 1 then
return path
end
-- fallback to default
return "~/projects/" .. plugin.name
end,
},
})
```
2024-01-20 21:19:09 +08:00
|
|
|
|
---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
|
2022-12-20 14:19:55 +08:00
|
|
|
|
path = "~/projects",
|
2022-12-15 04:03:53 +08:00
|
|
|
|
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
|
2022-12-01 06:08:00 +08:00
|
|
|
|
patterns = {}, -- For example {"folke"}
|
2023-01-25 05:55:34 +08:00
|
|
|
|
fallback = false, -- Fallback to git when local plugin doesn't exist
|
2022-11-21 05:34:55 +08:00
|
|
|
|
},
|
2022-12-03 02:18:10 +08:00
|
|
|
|
install = {
|
|
|
|
|
-- install missing plugins on startup. This doesn't increase startup time.
|
|
|
|
|
missing = true,
|
2022-12-15 04:03:53 +08:00
|
|
|
|
-- try to load one of these colorschemes when starting an installation during startup
|
2022-12-03 02:18:10 +08:00
|
|
|
|
colorscheme = { "habamax" },
|
|
|
|
|
},
|
2022-12-01 06:13:08 +08:00
|
|
|
|
ui = {
|
2022-12-21 02:29:28 +08:00
|
|
|
|
-- a number <1 is a percentage., >1 is a fixed size
|
|
|
|
|
size = { width = 0.8, height = 0.8 },
|
2023-01-19 15:45:27 +08:00
|
|
|
|
wrap = true, -- wrap the lines in the ui
|
2022-12-01 06:13:08 +08:00
|
|
|
|
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
|
|
|
|
border = "none",
|
2024-03-27 02:52:16 +08:00
|
|
|
|
-- The backdrop opacity. 0 is fully opaque, 100 is fully transparent.
|
|
|
|
|
backdrop = 60,
|
2023-05-27 20:28:09 +08:00
|
|
|
|
title = nil, ---@type string only works when border is not "none"
|
|
|
|
|
title_pos = "center", ---@type "center" | "left" | "right"
|
2023-07-21 05:48:50 +08:00
|
|
|
|
-- Show pills on top of the Lazy window
|
|
|
|
|
pills = true, ---@type boolean
|
2022-11-24 02:06:04 +08:00
|
|
|
|
icons = {
|
2022-12-06 06:14:04 +08:00
|
|
|
|
cmd = " ",
|
2022-11-24 02:06:04 +08:00
|
|
|
|
config = "",
|
2023-10-17 04:34:44 +08:00
|
|
|
|
event = " ",
|
2024-05-18 19:23:53 +08:00
|
|
|
|
favorite = " ",
|
2022-12-01 06:13:08 +08:00
|
|
|
|
ft = " ",
|
2022-12-06 06:14:04 +08:00
|
|
|
|
init = " ",
|
2023-01-02 16:44:09 +08:00
|
|
|
|
import = " ",
|
2022-12-06 06:14:04 +08:00
|
|
|
|
keys = " ",
|
2023-02-11 16:03:10 +08:00
|
|
|
|
lazy = " ",
|
2023-01-02 16:44:09 +08:00
|
|
|
|
loaded = "●",
|
|
|
|
|
not_loaded = "○",
|
2022-12-06 06:14:04 +08:00
|
|
|
|
plugin = " ",
|
|
|
|
|
runtime = " ",
|
2023-10-09 18:38:43 +08:00
|
|
|
|
require = " ",
|
2022-12-06 06:14:04 +08:00
|
|
|
|
source = " ",
|
2023-10-17 04:34:44 +08:00
|
|
|
|
start = " ",
|
2022-11-29 07:15:13 +08:00
|
|
|
|
task = "✔ ",
|
2022-12-26 17:24:47 +08:00
|
|
|
|
list = {
|
|
|
|
|
"●",
|
|
|
|
|
"➜",
|
|
|
|
|
"★",
|
|
|
|
|
"‒",
|
|
|
|
|
},
|
2022-11-24 02:06:04 +08:00
|
|
|
|
},
|
2022-12-31 03:41:23 +08:00
|
|
|
|
-- leave nil, to automatically select a browser depending on your OS.
|
|
|
|
|
-- If you want to use a specific browser, you can define it here
|
|
|
|
|
browser = nil, ---@type string?
|
2024-06-26 20:28:53 +08:00
|
|
|
|
throttle = 1000 / 30, -- how frequently should the ui process render events
|
2022-12-24 18:28:19 +08:00
|
|
|
|
custom_keys = {
|
2023-10-12 13:18:53 +08:00
|
|
|
|
-- You can define custom key maps here. If present, the description will
|
|
|
|
|
-- be shown in the help menu.
|
|
|
|
|
-- To disable one of the defaults, set it to false.
|
2022-12-24 18:28:19 +08:00
|
|
|
|
|
2023-10-12 13:18:53 +08:00
|
|
|
|
["<localleader>l"] = {
|
|
|
|
|
function(plugin)
|
|
|
|
|
require("lazy.util").float_term({ "lazygit", "log" }, {
|
|
|
|
|
cwd = plugin.dir,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
desc = "Open lazygit log",
|
|
|
|
|
},
|
2022-12-24 18:28:19 +08:00
|
|
|
|
|
2024-06-27 17:30:29 +08:00
|
|
|
|
["<localleader>i"] = {
|
|
|
|
|
function(plugin)
|
|
|
|
|
Util.notify(vim.inspect(plugin), {
|
|
|
|
|
title = "Inspect " .. plugin.name,
|
|
|
|
|
lang = "lua",
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
desc = "Inspect Plugin",
|
|
|
|
|
},
|
|
|
|
|
|
2023-10-12 13:18:53 +08:00
|
|
|
|
["<localleader>t"] = {
|
|
|
|
|
function(plugin)
|
|
|
|
|
require("lazy.util").float_term(nil, {
|
|
|
|
|
cwd = plugin.dir,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
desc = "Open terminal in plugin dir",
|
|
|
|
|
},
|
2022-12-24 18:28:19 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2024-06-27 03:38:28 +08:00
|
|
|
|
-- Output options for headless mode
|
|
|
|
|
headless = {
|
|
|
|
|
-- show the output from process commands like git
|
|
|
|
|
process = true,
|
|
|
|
|
-- show log messages
|
|
|
|
|
log = true,
|
|
|
|
|
-- show task start/end
|
|
|
|
|
task = true,
|
|
|
|
|
-- use ansi colors
|
|
|
|
|
colors = true,
|
|
|
|
|
},
|
2022-12-24 18:27:29 +08:00
|
|
|
|
diff = {
|
|
|
|
|
-- diff command <d> can be one of:
|
|
|
|
|
-- * browser: opens the github compare view. Note that this is always mapped to <K> as well,
|
|
|
|
|
-- so you can have a different command for diff <d>
|
|
|
|
|
-- * git: will run git diff and open a buffer with filetype git
|
|
|
|
|
-- * terminal_git: will open a pseudo terminal with git diff
|
|
|
|
|
-- * diffview.nvim: will open Diffview to show the diff
|
|
|
|
|
cmd = "git",
|
2022-11-29 22:25:09 +08:00
|
|
|
|
},
|
2022-12-06 03:49:23 +08:00
|
|
|
|
checker = {
|
2022-12-19 20:36:11 +08:00
|
|
|
|
-- automatically check for plugin updates
|
2022-12-06 03:49:23 +08:00
|
|
|
|
enabled = false,
|
2022-12-15 04:03:53 +08:00
|
|
|
|
concurrency = nil, ---@type number? set to 1 to check for updates very slowly
|
|
|
|
|
notify = true, -- get a notification when new updates are found
|
|
|
|
|
frequency = 3600, -- check for updates every hour
|
2023-10-23 13:52:54 +08:00
|
|
|
|
check_pinned = false, -- check for pinned packages that can't be updated
|
2022-12-06 03:49:23 +08:00
|
|
|
|
},
|
2022-12-21 02:38:32 +08:00
|
|
|
|
change_detection = {
|
|
|
|
|
-- automatically check for config file changes and reload the ui
|
|
|
|
|
enabled = true,
|
|
|
|
|
notify = true, -- get a notification when changes are found
|
|
|
|
|
},
|
2022-12-02 19:43:34 +08:00
|
|
|
|
performance = {
|
2023-02-13 19:01:56 +08:00
|
|
|
|
cache = {
|
|
|
|
|
enabled = true,
|
|
|
|
|
},
|
2022-12-15 04:03:53 +08:00
|
|
|
|
reset_packpath = true, -- reset the package path to improve startup time
|
|
|
|
|
rtp = {
|
|
|
|
|
reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory
|
2022-12-21 22:19:14 +08:00
|
|
|
|
---@type string[]
|
2023-01-22 22:24:13 +08:00
|
|
|
|
paths = {}, -- add any custom paths here that you want to includes in the rtp
|
2022-12-15 04:03:53 +08:00
|
|
|
|
---@type string[] list any plugins you want to disable here
|
|
|
|
|
disabled_plugins = {
|
|
|
|
|
-- "gzip",
|
|
|
|
|
-- "matchit",
|
|
|
|
|
-- "matchparen",
|
|
|
|
|
-- "netrwPlugin",
|
|
|
|
|
-- "tarPlugin",
|
|
|
|
|
-- "tohtml",
|
|
|
|
|
-- "tutor",
|
|
|
|
|
-- "zipPlugin",
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-12-02 19:43:34 +08:00
|
|
|
|
},
|
2022-12-15 21:34:08 +08:00
|
|
|
|
-- lazy can generate helptags from the headings in markdown readme files,
|
|
|
|
|
-- so :help works even for plugins that don't have vim docs.
|
|
|
|
|
-- when the readme opens with :help it will be correctly displayed as markdown
|
2022-12-15 21:07:37 +08:00
|
|
|
|
readme = {
|
2023-03-17 23:18:02 +08:00
|
|
|
|
enabled = true,
|
2022-12-15 21:07:37 +08:00
|
|
|
|
root = vim.fn.stdpath("state") .. "/lazy/readme",
|
2023-01-02 03:23:41 +08:00
|
|
|
|
files = { "README.md", "lua/**/README.md" },
|
2022-12-15 21:34:08 +08:00
|
|
|
|
-- only generate markdown helptags for plugins that dont have docs
|
2022-12-15 21:07:37 +08:00
|
|
|
|
skip_if_doc_exists = true,
|
|
|
|
|
},
|
2023-01-18 15:24:43 +08:00
|
|
|
|
state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things
|
2023-10-09 18:38:43 +08:00
|
|
|
|
-- Enable profiling of lazy.nvim. This will add some overhead,
|
|
|
|
|
-- so only enable this when you are debugging lazy.nvim
|
|
|
|
|
profiling = {
|
|
|
|
|
-- Enables extra stats on the debug tab related to the loader cache.
|
|
|
|
|
-- Additionally gathers stats about all package.loaders
|
|
|
|
|
loader = false,
|
|
|
|
|
-- Track each new require in the Lazy profiling tab
|
|
|
|
|
require = false,
|
|
|
|
|
},
|
2022-12-02 23:52:22 +08:00
|
|
|
|
debug = false,
|
2022-11-21 05:33:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-29 17:44:31 +08:00
|
|
|
|
function M.hererocks()
|
|
|
|
|
if M.options.rocks.hererocks == nil then
|
|
|
|
|
M.options.rocks.hererocks = vim.fn.executable("luarocks") == 0
|
|
|
|
|
end
|
|
|
|
|
return M.options.rocks.hererocks
|
|
|
|
|
end
|
|
|
|
|
|
2024-07-13 15:25:55 +08:00
|
|
|
|
M.version = "11.11.0" -- x-release-please-version
|
2023-01-10 16:28:54 +08:00
|
|
|
|
|
2022-11-21 05:33:47 +08:00
|
|
|
|
M.ns = vim.api.nvim_create_namespace("lazy")
|
|
|
|
|
|
2023-01-02 04:07:05 +08:00
|
|
|
|
---@type LazySpecLoader
|
2023-01-02 16:44:09 +08:00
|
|
|
|
M.spec = nil
|
2023-01-02 04:07:05 +08:00
|
|
|
|
|
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 = {}
|
|
|
|
|
|
2022-12-17 17:06:40 +08:00
|
|
|
|
---@type string
|
|
|
|
|
M.me = nil
|
|
|
|
|
|
2022-12-21 17:51:31 +08:00
|
|
|
|
---@type string
|
|
|
|
|
M.mapleader = nil
|
|
|
|
|
|
2024-03-08 00:32:07 +08:00
|
|
|
|
---@type string
|
|
|
|
|
M.maplocalleader = nil
|
|
|
|
|
|
2024-07-08 13:28:02 +08:00
|
|
|
|
M.suspended = false
|
|
|
|
|
|
2023-01-07 16:01:45 +08:00
|
|
|
|
function M.headless()
|
2024-07-08 13:28:02 +08:00
|
|
|
|
return not M.suspended and #vim.api.nvim_list_uis() == 0
|
2023-01-07 16:01:45 +08:00
|
|
|
|
end
|
2022-12-22 05:28:09 +08:00
|
|
|
|
|
2022-11-21 05:33:47 +08:00
|
|
|
|
---@param opts? LazyConfig
|
2023-01-02 16:44:09 +08:00
|
|
|
|
function M.setup(opts)
|
2022-11-21 05:34:55 +08:00
|
|
|
|
M.options = vim.tbl_deep_extend("force", M.defaults, opts or {})
|
2023-01-02 16:44:09 +08:00
|
|
|
|
|
|
|
|
|
if type(M.options.spec) == "string" then
|
|
|
|
|
M.options.spec = { import = M.options.spec }
|
|
|
|
|
end
|
2022-12-03 02:18:10 +08:00
|
|
|
|
table.insert(M.options.install.colorscheme, "habamax")
|
|
|
|
|
|
2024-06-02 20:51:44 +08:00
|
|
|
|
-- root
|
2022-12-20 14:19:55 +08:00
|
|
|
|
M.options.root = Util.norm(M.options.root)
|
feat(plugin): dev.path can now be a function (#1157)
In some case, `dev.path .. plugin.name` is not enoguh.
For example, when using `ghq` to manage projects, plugin directories may
vary by onewrs of the plugins.
With this change, users can do something like below
``` lua
require("lazy").setup("plugins", {
dev = {
path = function(p)
-- ghq
local path, cnt = string.gsub(p.url, "^https://(.*)%.git$", "~/ghq/%1")
if cnt == 1 then
return path
end
-- fallback to default
return "~/projects/" .. plugin.name
end,
},
})
```
2024-01-20 21:19:09 +08:00
|
|
|
|
if type(M.options.dev.path) == "string" then
|
|
|
|
|
M.options.dev.path = Util.norm(M.options.dev.path)
|
|
|
|
|
end
|
2022-12-20 14:19:55 +08:00
|
|
|
|
M.options.lockfile = Util.norm(M.options.lockfile)
|
|
|
|
|
M.options.readme.root = Util.norm(M.options.readme.root)
|
|
|
|
|
|
2023-02-28 18:51:16 +08:00
|
|
|
|
vim.fn.mkdir(M.options.root, "p")
|
|
|
|
|
|
2022-12-02 19:52:06 +08:00
|
|
|
|
if M.options.performance.reset_packpath then
|
2022-12-29 23:04:45 +08:00
|
|
|
|
vim.go.packpath = vim.env.VIMRUNTIME
|
2022-12-01 18:23:34 +08:00
|
|
|
|
end
|
2022-12-20 23:02:06 +08:00
|
|
|
|
|
|
|
|
|
M.me = debug.getinfo(1, "S").source:sub(2)
|
|
|
|
|
M.me = Util.norm(vim.fn.fnamemodify(M.me, ":p:h:h:h:h"))
|
2024-07-14 00:07:56 +08:00
|
|
|
|
local lib = vim.fn.fnamemodify(vim.v.progpath, ":p:h:h") .. "/lib"
|
|
|
|
|
lib = vim.uv.fs_stat(lib .. "64") and (lib .. "64") or lib
|
|
|
|
|
lib = lib .. "/nvim"
|
2022-12-15 04:03:53 +08:00
|
|
|
|
if M.options.performance.rtp.reset then
|
2024-06-04 12:58:19 +08:00
|
|
|
|
---@type vim.Option
|
2022-12-04 00:42:54 +08:00
|
|
|
|
vim.opt.rtp = {
|
2022-12-29 15:21:22 +08:00
|
|
|
|
vim.fn.stdpath("config"),
|
2023-06-08 23:23:02 +08:00
|
|
|
|
vim.fn.stdpath("data") .. "/site",
|
2022-12-29 23:03:23 +08:00
|
|
|
|
M.me,
|
2022-12-15 04:03:53 +08:00
|
|
|
|
vim.env.VIMRUNTIME,
|
2024-07-14 00:07:56 +08:00
|
|
|
|
lib,
|
2022-12-16 06:23:18 +08:00
|
|
|
|
vim.fn.stdpath("config") .. "/after",
|
2022-12-04 00:42:54 +08:00
|
|
|
|
}
|
|
|
|
|
end
|
2022-12-21 22:19:14 +08:00
|
|
|
|
for _, path in ipairs(M.options.performance.rtp.paths) do
|
|
|
|
|
vim.opt.rtp:append(path)
|
|
|
|
|
end
|
2022-12-15 21:07:37 +08:00
|
|
|
|
vim.opt.rtp:append(M.options.readme.root)
|
2022-11-21 05:33:47 +08:00
|
|
|
|
|
2022-12-15 04:25:11 +08:00
|
|
|
|
-- disable plugin loading since we do all of that ourselves
|
|
|
|
|
vim.go.loadplugins = false
|
2022-12-21 17:51:31 +08:00
|
|
|
|
M.mapleader = vim.g.mapleader
|
2024-03-08 00:32:07 +08:00
|
|
|
|
M.maplocalleader = vim.g.maplocalleader
|
2022-12-15 04:25:11 +08:00
|
|
|
|
|
2023-01-07 16:12:51 +08:00
|
|
|
|
vim.api.nvim_create_autocmd("UIEnter", {
|
|
|
|
|
once = true,
|
|
|
|
|
callback = function()
|
|
|
|
|
require("lazy.stats").on_ui_enter()
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
2024-06-26 17:10:43 +08:00
|
|
|
|
if M.headless() then
|
|
|
|
|
require("lazy.view.commands").setup()
|
|
|
|
|
else
|
|
|
|
|
vim.api.nvim_create_autocmd("User", {
|
|
|
|
|
pattern = "VeryLazy",
|
|
|
|
|
once = true,
|
|
|
|
|
callback = function()
|
|
|
|
|
require("lazy.view.commands").setup()
|
|
|
|
|
if M.options.change_detection.enabled then
|
|
|
|
|
require("lazy.manage.reloader").enable()
|
|
|
|
|
end
|
|
|
|
|
if M.options.checker.enabled then
|
|
|
|
|
vim.defer_fn(function()
|
|
|
|
|
require("lazy.manage.checker").start()
|
|
|
|
|
end, 10)
|
|
|
|
|
end
|
2024-06-19 01:40:58 +08:00
|
|
|
|
|
2024-06-26 17:10:43 +08:00
|
|
|
|
-- useful for plugin developers when making changes to a packspec file
|
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
|
|
|
|
pattern = { "lazy.lua", "pkg.json", "*.rockspec" },
|
|
|
|
|
callback = function()
|
2024-06-27 15:48:37 +08:00
|
|
|
|
local plugin = require("lazy.core.plugin").find(vim.uv.cwd() .. "/lua/")
|
|
|
|
|
if plugin then
|
|
|
|
|
require("lazy").pkg({ plugins = { plugin } })
|
|
|
|
|
end
|
2024-06-26 17:10:43 +08:00
|
|
|
|
end,
|
|
|
|
|
})
|
2024-07-08 13:28:02 +08:00
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ "VimSuspend", "VimResume" }, {
|
|
|
|
|
callback = function(ev)
|
|
|
|
|
M.suspended = ev.event == "VimSuspend"
|
|
|
|
|
end,
|
|
|
|
|
})
|
2024-06-26 17:10:43 +08:00
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
2023-01-07 16:12:51 +08:00
|
|
|
|
|
2022-11-21 05:34:55 +08:00
|
|
|
|
Util.very_lazy()
|
2022-11-21 05:33:47 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|