字符和字符串常数支持标准换码序列。
Character and string constants support the standard escape sequences.
这通过使用“{%…%}”语法来封装所有换码序列来完成。
This is done by using the "{%... %}" syntax to enclose any escape sequences. Let's illustrate all of this with an example.
通常的换码序列是 "ESC-[31m",其中 "1"指定前景颜色,可以是任何从0(缺省)到9 的任何数字。
The usual escape sequence is "ESC-[31m", where the "1" specifies the foreground color, and can be any digit from 0 (default) to 9.
另一个需要注意的是需要告诉Zsh在提示符中哪些字符构成换码序列,否则就会假设它们都是可打印字符,光标的位置就会出错。
Another point to be aware of is the need to tell Zsh which characters form escape sequence in a prompt, otherwise it will assume they are all printable characters, and position the cursor incorrectly.
另一个需要注意的是需要告诉Zsh在提示符中哪些字符构成换码序列,否则就会假设它们都是可打印字符,光标的位置就会出错。
Another point to be aware of is the need to tell Zsh which characters form escape sequence in a prompt, otherwise it will assume they are all printable characters, and position the cursor incorrectly.
应用推荐