about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2021-04-14 14:49:13 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2021-04-15 16:27:53 +0000
commitebcb20a9c0d3469e5ddf2186054ec5a5f7493e58 (patch)
tree2c22cb8a0b386cd8ab1b6a8ad8ec80eb7eeb2640
parentcc833e01fef8298bc385bcff98f1b7ae85a8642a (diff)
downloadzsh-ebcb20a9c0d3469e5ddf2186054ec5a5f7493e58.tar.gz
zsh-ebcb20a9c0d3469e5ddf2186054ec5a5f7493e58.tar.xz
zsh-ebcb20a9c0d3469e5ddf2186054ec5a5f7493e58.zip
45583/0005: vcs_info docs: Recommend use of prompt expandos rather than terminal escape sequences.
-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):