summaryrefslogtreecommitdiffstats
path: root/docs/zh-CN/advanced-config/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/zh-CN/advanced-config/README.md')
-rw-r--r--docs/zh-CN/advanced-config/README.md28
1 files changed, 25 insertions, 3 deletions
diff --git a/docs/zh-CN/advanced-config/README.md b/docs/zh-CN/advanced-config/README.md
index 0ef535d66..e4afa3ff9 100644
--- a/docs/zh-CN/advanced-config/README.md
+++ b/docs/zh-CN/advanced-config/README.md
@@ -58,9 +58,9 @@ load(io.popen('starship init cmd'):read("*a"))()
可以用自定义字符串替换预设的命令行提示。 这在不经常需要所有提示信息的情况下很有用。 若要启用该功能,请在 shell 中运行 `Enable-TransitientPrompt`命令 若要永久启用该功能,请将 上述语句放在您的 `~/.config/fish/config.fish` 中。 通过在shell中运行 `Disable-TransientPrompt`命令来禁用这项功能。
-请注意,对于Fish,命令行提示只在命令行非空 和语法正确的情况下才会显示。
+请注意,对于Fish,命令行提示只在命令行非空 且语法正确的情况下才会显示。
-- 默认情况下,输入的左侧是 粗体绿色的❯</code>符号。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 例如,要 在这里显示Starship的 `character` 模块,您需要如下操作:
+- 默认情况下,输入的左侧是 粗体绿色的`❯`符号。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 例如,要在这里显示 Starship 的 `character` 组件,您需要如下操作:
```fish
function starship_transent_rmpt_func
@@ -80,6 +80,26 @@ starship init fish | source
enable_transience
```
+## TransientPrompt and TransientRightPrompt in Bash
+
+The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable this, put this in `~/.bashrc` `bleopt prompt_ps1_transient=<value>`:
+
+The \<value\> here is a colon-separated list of `always`, `same-dir` and `trim`. When `prompt_ps1_final` is empty and this option has a non-empty value, the prompt specified by `PS1` is erased on leaving the current command line. If the value contains a field `trim`, only the last line of multiline `PS1` is preserved and the other lines are erased. Otherwise, the command line will be redrawn as if `PS1=` is specified. When a field `same-dir` is contained in the value and the current working directory is different from the final directory of the previous command line, this option `prompt_ps1_transient` is ignored.
+
+Make the following changes to your `~/.bashrc` to customize what gets displayed on the left and on the right:
+
+- To customize what the left side of input gets replaced with, configure the `prompt_ps1_final` Ble.sh option. For example, to display Starship's `character` module here, you would do
+
+```bash
+bleopt prompt_ps1_final="$(starship module character)"
+```
+
+- To customize what the right side of input gets replaced with, configure the `prompt_rps1_final` Ble.sh option. 例如,要在这里显示 最后一个命令开始的时间,您需要如下操作:
+
+```bash
+bleopt prompt_rps1_final="$(starship module time)"
+```
+
## 在 Cmd 中自定义提示符显示前和执行前的命令
Clink 提供了很灵活的 API,能在 Cmd shell 中运行预提示和执行前命令。 在 Starship 中使用这些 API 很容易。 对你的 `starship.lua` 按需做出如下修改:
@@ -205,7 +225,9 @@ Invoke-Expression (&starship init powershell)
注意:右侧提示和输入区显示在同一行。 如果需要在输入区的上方显示右对齐的组件,请查阅 [`fill` 组件](/config/#fill)。
-`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd, nushell.
+`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd, nushell, bash.
+
+Note: The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework should be installed in order to use right prompt in bash.
### 示例