26.5.3 Oddities

If you want to use the %b (bold off) prompt expansion in formats, which expands %b itself, use %%b. That will cause the vcs_info expansion to replace %%b with %b, so that zsh’s prompt expansion mechanism can handle it. Similarly, to hand down %b from branchformat, use %%%%b. Sorry for this inconvenience, but it cannot be easily avoided. Luckily we do not clash with a lot of prompt expansions and this only needs to be done for those.

When one of the gen-applied-string, gen-unapplied-string, and set-patch-format hooks is defined, applying %-escaping (‘foo=${foo//'%'/%%}’) to the interpolated values for use in the prompt is the responsibility of those hooks (jointly); when neither of those hooks is defined, vcs_info handles escaping by itself. We regret this coupling, but it was required for backwards compatibility.