summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/contrib.yo14
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 547780dc8..107900c80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2021-04-15 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 45583/0005: Doc/Zsh/contrib.yo: vcs_info docs: Recommend use
+ of prompt expandos rather than terminal escape sequences.
+
* 45583/0004: Doc/Zsh/func.yo: docs: Document that hook functions
may rely on $? (see workers/48570).
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 5e91f9a8d..07bf4e054 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -1827,9 +1827,21 @@ If you do use tt(use-simple), please report if it does `the-right-thing[tm]'.
Display the revision number in yellow for tt(bzr) and tt(svn):
example(zstyle ':vcs_info:(svn|bzr):*' \
+ branchformat '%b%%F{yellow}:%r')
+
+The doubled percent sign is explained in
+ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).
+
+Alternatively, one can use the raw colour codes directly:
+
+example(zstyle ':vcs_info:(svn|bzr):*' \
branchformat '%b%{'${fg[yellow]}'%}:%r')
-If you want colors, make sure you enclose the color codes in tt(%{)var(...)tt(%})
+Normally when a variable is interpolated into a format string, the variable
+needs to be tt(%)-escaped. In this example we skipped that because we assume
+the value of tt(${fg[yellow]}) doesn't contain any tt(%) signs.
+
+Make sure you enclose the color codes in tt(%{)var(...)tt(%})
if you want to use the string provided by tt(vcs_info) in prompts.
Here is how to print the VCS information as a command (not in a prompt):