chore: move chezmoi autocmd to the plugin file

This commit is contained in:
Mariano Z. 2024-12-26 10:53:59 -03:00
parent b265dacc53
commit 72f903d231
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
3 changed files with 14 additions and 14 deletions

View file

@ -23,6 +23,7 @@ return {
on_apply = true, -- vim.notify on apply.
},
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
callback = function()
@ -30,6 +31,12 @@ return {
vim.schedule(require("chezmoi.commands.__edit").watch)
end,
})
-- Auto-apply chezmoi changes
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
command = [[silent! !chezmoi apply --source-path "%"]],
})
end,
},
}