一键导入
chezmoi-configuration
Configure chezmoi behavior: source/target dirs, data injection, encryption, editor, diff/merge tools, git auto-commit, and operation hooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Configure chezmoi behavior: source/target dirs, data injection, encryption, editor, diff/merge tools, git auto-commit, and operation hooks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Write chezmoi templates: OS/machine conditionals, user-defined data variables, Sprig functions, shared fragments, and interactive prompts.
Run scripts on apply, once, or on content change — manage run_, run_once_, run_onchange_, run_before_, and run_after_ scripts and their state.
Integrate with password managers (Bitwarden, 1Password, etc.) and manage encrypted files using age or gpg.
Bootstrap chezmoi on a new machine, clone an existing dotfiles repo, migrate existing dotfiles, or run one-shot init scripts.
Work with the chezmoi source directory: file naming prefixes, adding/removing files, externals (.chezmoiexternal for external files, archives, and git repos), special directories (.chezmoiignore, .chezmoitemplates/), and git operations.
Look up and run chezmoi commands: add, apply, diff, status, update, verify, edit, merge, re-add, state, and other core operations on the target directory.
| name | chezmoi-configuration |
| description | Configure chezmoi behavior: source/target dirs, data injection, encryption, editor, diff/merge tools, git auto-commit, and operation hooks. |
chezmoi reads its config file from ~/.config/chezmoi/chezmoi.$FORMAT, where $FORMAT is one of json, jsonc, toml, or yaml.
If multiple formats are present, chezmoi reports an error.
Use chezmoi doctor to confirm the path chezmoi is actually using.
[data]
email = "user@example.com"
name = "User Name"
| Key | Purpose |
|---|---|
sourceDir | Override the source directory (default: ~/.local/share/chezmoi) |
destDir | Override the target directory (default: ~) |
umask | Set default file permissions |
pager | Command used to page output (diff, status, etc.) |
color | "auto", "true", or "false" |
mode | "file" (default) or "symlink" |
See references/core.md for a full list of top-level options.
[data]
gitEmail = "work@company.com"
personal = false
os = "linux"
Static data can also live in .chezmoidata.$FORMAT files in the source directory.
See references/data.md for more on data injection and templating.
The top-level encryption option (age, gpg, or transparent) plus an [age] or [gpg] section configure encrypted files.
encryption must appear before any section in the config file.
The chezmoi-secrets-management skill owns encryption setup, key generation, and workflows.
[edit]
command = "nvim"
args = []
[diff]
command = "delta"
pager = "less"
[merge]
command = "nvim"
args = ["-d", "{{ .Destination }}", "{{ .Source }}", "{{ .Target }}"]
See references/tools.md for full configuration properties of [edit], [diff], and [merge].
[hooks.apply.pre]
command = "echo"
args = ["applying chezmoi"]
Hooks can be defined for any command (apply, add, update, ...) plus the git-auto-commit, git-auto-push, and read-source-state events, each with .pre and .post variants.
Hooks always run, even with --dry-run.
See references/hooks.md for more hook examples and configurations.
[git]
autoCommit = true
autoPush = false
commitMessageTemplate = "chore: update dotfiles"
With autoCommit = true, chezmoi commits whenever a change is made to the source directory.
See references/git.md for a full list of [git] configuration options.
Do not use multiple config files — use a single .chezmoi.$FORMAT.tmpl config template to branch per machine.
The chezmoi-machine-config skill owns multi-machine patterns.