Skip to content

.chezmoitemplates

If a directory called .chezmoitemplates exists, then all files in this directory are available as templates with a name equal to the relative path to the .chezmoitemplates directory.

The template action can be used to include these templates in another template. The value of . must be set explicitly if needed, otherwise the template will be executed with nil data.

Example

Given:

~/.local/share/chezmoi/.chezmoitemplates/foo
{{ if true }}bar{{ end }}
~/.local/share/chezmoi/dot_file.tmpl
{{ template "foo" . }}

The target state of .file will be bar.