-- Editing chezmoi source files (dot_*, *.tmpl) in their *underlying* language.
-- alker0/chezmoi.vim detects managed files under the source dir, resolves the
-- chezmoi naming (dot_foo → .foo) and the `.tmpl` suffix, sets the base
-- filetype, and merges go-template syntax over the {{ }} regions.
--
-- Pairs with:
--   • conform `.tmpl` skip (plugins/editing.lua) — formatters never corrupt templates
--   • the `chezmoitmpl` FileType guard (autocmds.lua) — stops treesitter highlight
--     (the plugin's vim-syntax owns templates) and silences {{ }} diagnostics
return {
  {
    "alker0/chezmoi.vim",
    lazy = false, -- detection hooks must register before any source file opens
    init = function()
      -- required for reliable filetype detection under lazy.nvim
      vim.g["chezmoi#use_tmp_buffer"] = true
      vim.g["chezmoi#source_dir_path"] = vim.fn.expand("~/.local/share/chezmoi")
    end,
  },
}
