Merge
Use a custom merge command
By default, chezmoi uses vimdiff. You can use a custom command by setting the
merge.command and merge.args configuration variables. The elements of
merge.args are interpreted as templates with the variables .Destination,
.Source, and .Target containing filenames of the file in the destination
state, source state, and target state respectively. For example, to use
neovim's diff mode, specify:
~/.config/chezmoi/chezmoi.toml
[merge]
    command = "nvim"
    args = ["-d", "{{ .Destination }}", "{{ .Source }}", "{{ .Target }}"]
Hint
If you generate your config file from a config file template, then you'll
need to escape the {{ and }}. That way your generated config file
contains the {{ and }} you expect.
~/.local/share/chezmoi/chezmoi.toml.tmpl
[merge]
    command = "nvim"
    args = [
        "-d",
        {{ printf "%q" "{{ .Destination }}" }},
        {{ printf "%q" "{{ .Source }}" }},
        {{ printf "%q" "{{ .Target }}" }},
    ]
Use Beyond Compare as the merge tool
To use Beyond Compare as the merge tool, add the following to your config:
~/.config/chezmoi/chezmoi.toml
[merge]
    command = "bcomp"
    args = ["{{ .Destination }}", "{{ .Source }}", "{{ .Target }}", "{{ .Source }}"]
~/.config/chezmoi/chezmoi.yaml
merge:
  command: "bcomp"
  args:
  - "{{ .Destination }}"
  - "{{ .Source }}"
  - "{{ .Target }}"
  - "{{ .Source }}"
Use VSCode as the merge tool
To use VSCode as the merge tool, add the following to your config:
~/.config/chezmoi/chezmoi.toml
[merge]
command = "bash"
args = [
    "-c",
    "cp {{ .Target }} {{ .Target }}.base && code --new-window --wait --merge {{ .Destination }} {{ .Target }} {{ .Target }}.base {{ .Source }}",
]
~/.config/chezmoi/chezmoi.yaml
merge:
  command: "bash"
  args:
  - "-c"
  - "cp {{ .Target }} {{ .Target }}.base && code --new-window --wait --merge {{ .Destination }} {{ .Target }} {{ .Target }}.base {{ .Source }}"