Files
nvim-modular/lua/kickstart/plugins/chezmoi.lua
2025-08-28 23:17:34 +02:00

48 lines
1.1 KiB
Lua

-- chezmoi
--
-- chezmoi.nvim is a plugin designed to assist in editing and
-- applying chezmoi-managed files within neovim.
-- A notable distinction from the command line tool chezmoi is that
-- chezmoi.nvim utilizes built-in neovim functions for file editing,
-- allowing us to edit and watch multiple files simultaneously.
--
-- https://github.com/xvzc/chezmoi.nvim
--
return {
{
'xvzc/chezmoi.nvim',
cmd = { 'ChezmoiEdit' },
keys = {
{
'<leader>sc',
pick_chezmoi,
desc = 'search [c]hezmoi',
},
},
opts = {
edit = {
watch = false,
force = false,
},
notification = {
on_open = true,
on_apply = true,
on_watch = false,
},
telescope = {
select = { '<CR>' },
},
},
init = function()
-- run chezmoi edit on file enter
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { os.getenv 'HOME' .. '/.local/share/chezmoi/*' },
callback = function()
vim.schedule(require('chezmoi.commands.__edit').watch)
end,
})
end,
},
}