Add nil guard to lazy.load and custom mini.diff mappings

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-28 11:43:06 +08:00
parent 7c5529c400
commit 61f2c89362
2 changed files with 7 additions and 1 deletions

View File

@ -7,8 +7,10 @@ M.load = function(name, fn)
return return
end end
M._loaded[name] = true M._loaded[name] = true
if fn then
fn() fn()
end end
end
M.on_event = function(name, event, pattern, fn) M.on_event = function(name, event, pattern, fn)
vim.api.nvim_create_autocmd(event, { vim.api.nvim_create_autocmd(event, {

View File

@ -128,6 +128,10 @@ end)
lazy.on_event("diff", "BufReadPost", "*", function() lazy.on_event("diff", "BufReadPost", "*", function()
require("mini.diff").setup({ require("mini.diff").setup({
source = require("mini.diff").gen_source.git({ index = false }), source = require("mini.diff").gen_source.git({ index = false }),
mappings = {
apply = "gs",
textobject = "",
},
}) })
end) end)