- Create lua/lazy.lua helper with load/on_event/on_keys - Rewrite pack.lua: lazy load all mini modules + fugitive - Defer treesitter.install() with vim.defer_fn - Defer mason + LSP config to VimEnter - Move mini.pick keymaps from keymaps.lua to pack.lua - Keep mini.notify and mini.cmdline eager (startup needed) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
670 B
Lua
35 lines
670 B
Lua
local M = {}
|
|
|
|
M._loaded = {}
|
|
|
|
M.load = function(name, fn)
|
|
if M._loaded[name] then
|
|
return
|
|
end
|
|
M._loaded[name] = true
|
|
fn()
|
|
end
|
|
|
|
M.on_event = function(name, event, pattern, fn)
|
|
vim.api.nvim_create_autocmd(event, {
|
|
pattern = pattern or "*",
|
|
once = true,
|
|
callback = function()
|
|
M.load(name, fn)
|
|
end,
|
|
})
|
|
end
|
|
|
|
M.on_keys = function(name, keys, mode, fn, action, opts)
|
|
mode = mode or "n"
|
|
opts = opts or {}
|
|
vim.keymap.set(mode, keys, function()
|
|
M.load(name, fn)
|
|
if action then
|
|
action()
|
|
end
|
|
end, { desc = opts.desc, buffer = opts.buffer })
|
|
end
|
|
|
|
return M
|