diff options
Diffstat (limited to 'docs/zh-CN')
-rw-r--r-- | docs/zh-CN/README.md | 5 | ||||
-rw-r--r-- | docs/zh-CN/advanced-config/README.md | 76 | ||||
-rw-r--r-- | docs/zh-CN/config/README.md | 288 | ||||
-rw-r--r-- | docs/zh-CN/guide/README.md | 1 | ||||
-rw-r--r-- | docs/zh-CN/presets/README.md | 4 | ||||
-rw-r--r-- | docs/zh-CN/presets/bracketed-segments.md | 2 | ||||
-rw-r--r-- | docs/zh-CN/presets/pure-preset.md | 2 |
7 files changed, 227 insertions, 151 deletions
diff --git a/docs/zh-CN/README.md b/docs/zh-CN/README.md index bd36f8ad9..0ddd1e58b 100644 --- a/docs/zh-CN/README.md +++ b/docs/zh-CN/README.md @@ -55,11 +55,10 @@ description: Starship是一款轻量级、反应迅速、可自定义的高颜 ```sh brew install starship ``` - - 使用 [Scoop](https://scoop.sh): + With [Winget](https://github.com/microsoft/winget-cli): ```powershell - scoop install starship + winget install starship ``` 1. 将初始化脚本添加到您的 shell 的配置文件: diff --git a/docs/zh-CN/advanced-config/README.md b/docs/zh-CN/advanced-config/README.md index fc2c670cf..1ed5b3b55 100644 --- a/docs/zh-CN/advanced-config/README.md +++ b/docs/zh-CN/advanced-config/README.md @@ -8,11 +8,11 @@ Starship 功能繁多,有时您必须在编辑 `starship.toml` 之外做更多 ::: -## TransientPrompt in PowerShell +## PowerShell中的命令行提示(TransientPrompt) -It is possible to replace the previous-printed prompt with a custom string. This is useful in cases where all the prompt information is not always needed. To enable this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put this statement in your `$PROFILE`. Transience can be disabled on-the-fly with `Disable-TransientPrompt`. +可以用自定义字符串替换预设的命令行提示。 这在不经常需要所有提示信息的情况下很有用。 若要启用该功能,请在 shell 中运行 `Enable-TransitientPrompt`命令 若要永久启用该功能,请将 上述语句放在您的 `$PROFILE` 中。 通过在shell中运行 `Disable-TransientPrompt`命令来禁用这项功能。 -By default, the left side of input gets replaced with `>`. To customize this, define a new function called `Invoke-Starship-TransientFunction`. For example, to display Starship's `character` module here, you would do +默认情况下,输入的左侧是 `>`符号。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 例如,要 在这里显示Starship的 `character` 模块,您需要如下操作: ```powershell function Invoke-Starship-TransientFunction { @@ -24,28 +24,28 @@ Invoke-Expression (&starship init powershell) Enable-TransientPrompt ``` -## TransientPrompt and TransientRightPrompt in Cmd +## 在 Cmd 中的 命令行提示(TransitentPrompt )和 语法高亮(TransentRightPrompt) -Clink 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, run `clink set prompt.transient <value>` where \<value\> can be one of: +可以用自定义字符串替换预设的命令行提示。 这在不经常需要所有提示信息的情况下很有用。 要启用该功能,运行命令`clink set prompt.transient <value>`,<prompt.transient>之后跟以下单词中的一个: -- `always`: always replace the previous prompt -- `same_dir`: replace the previous prompt only if the working directory is same -- `off`: do not replace the prompt (i.e. turn off transience) +- `always`: 总是预设的提示 +- `same_dir`: 仅在工作目录相同的情况下替换预设的提示 +- `off`: 不要替换提示(即关闭命令行提示) -You need to do this only once. Make the following changes to your `starship.lua` to customize what gets displayed on the left and on the right: +你只需要这样做一次。 对您的 `starship.lua` 进行以下更改,以自定义左侧和右侧显示的内容: -- By default, the left side of input gets replaced with `>`. To customize this, define a new function called `starship_transient_prompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display Starship's `character` module here, you would do +- 默认情况下,输入的左侧是 `>`符号。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 This function receives the current prompt as a string that you can utilize. 例如,要 在这里显示Starship的 `character` 模块,您需要如下操作: ```lua -function starship_transient_prompt_func(prompt) +function starship_transitent_propt_func(empt) return io.popen("starship module character" - .." --keymap="..rl.getvariable('keymap') + ..." --keymap="..rl.getvariable('keymap') ):read("*a") end -load(io.popen('starship init cmd'):read("*a"))() +load(io.popen('starship init cmd'):read("*a")) ``` -- By default, the right side of input is empty. To customize this, define a new function called `starship_transient_rprompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display the time at which the last command was started here, you would do +- 默认情况下,输入的右侧为空。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 This function receives the current prompt as a string that you can utilize. 例如,要在这里显示 最后一个命令开始的时间,您需要如下操作: ```lua function starship_transient_rprompt_func(prompt) @@ -54,6 +54,32 @@ end load(io.popen('starship init cmd'):read("*a"))() ``` +## 在 Fish 中的 命令行提示(TransitentPrompt)和语法高亮(TransentRightPrompt) + +可以用自定义字符串替换预设的命令行提示。 这在不经常需要所有提示信息的情况下很有用。 若要启用该功能,请在 shell 中运行 `Enable-TransitientPrompt`命令 若要永久启用该功能,请将 上述语句放在您的 `~/.config/fish/config.fish` 中。 通过在shell中运行 `Disable-TransientPrompt`命令来禁用这项功能。 + +请注意,对于Fish,命令行提示只在命令行非空 和语法正确的情况下才会显示。 + +- 默认情况下,输入的左侧是 粗体绿色的❯</code>符号。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 例如,要 在这里显示Starship的 `character` 模块,您需要如下操作: + +```fish +function starship_transent_rmpt_func + starship module time +end +starship init fish | source +enable_transience +``` + +- 默认情况下,输入的右侧为空。 要自定义它,请定义一个新函数,名为 `Invoke-Starship-TransitentFunction`。 例如,要在这里显示 最后一个命令开始的时间,您需要如下操作: + +```fish +function starship_transent_rmpt_func + starship module time +end +starship init fish | source +enable_transience +``` + ## 在 Cmd 中自定义提示符显示前和执行前的命令 Clink 提供了很灵活的 API,能在 Cmd shell 中运行预提示和执行前命令。 在 Starship 中使用这些 API 很容易。 对你的 `starship.lua` 按需做出如下修改: @@ -78,11 +104,11 @@ end load(io.popen('starship init cmd'):read("*a"))() ``` -## 在 Bash 中自定义预提示和预执行命令 +## 在 Bash 中自定义提示符显示前和执行前的命令 -Bash 并没有类似大多数其它 shell 的正式预执行/预命令框架。 因此,很难在 `bash` 中提供完全可自定义的 hook 机制。 然而,Starship 确实能使您有限地在提示符渲染过程中插入自己的函数执行: +Bash 不像多数其他的 Shell 有成体系的预执行框架。 因此,很难在 `bash` 中提供完全可自定义的 hook 机制。 然而,Starship 确实能使您有限地在提示符渲染过程中插入自己的函数执行: -- 若要在提示符显示之前运行自定义函数,需要定义此函数,然后将函数名赋值给 `starship_reserved_user_func`。 例如,要在提示符之前绘制一枚火箭,您应该写 +- 若要在提示符显示之前运行自定义函数,需要定义此函数,然后将函数名赋值给 `starship_reserved_user_func`。 例如,如果想在提示符前绘制一个火箭,可以这样写: ```bash function blastoff(){ @@ -175,7 +201,7 @@ Invoke-Expression (&starship init powershell) ## 启用右侧提示 -一些 Shell 支持右侧提示, 它与输入区渲染在同一行。 Starship 可以设置右侧提示的内容,使用 `right_format` 选项。 所有支持 `format` 的组件也同时支持 `right_format`。 未显式在 `format` 或 `right_format` 中使用的组件,会保存在变量 `$all` 中。 +一些 Shell 支持右侧提示, 它与输入区渲染在同一行。 使用 `right_format` 选项来设置 Starship 的右侧提示。 所有支持 `format` 的组件也同时支持 `right_format`。 未显式在 `format` 或 `right_format` 中使用的组件,会保存在变量 `$all` 中。 注意:右侧提示和输入区显示在同一行。 如果需要在输入区的上方显示右对齐的组件,请查阅 [`fill` 组件](/config/#fill)。 @@ -239,11 +265,11 @@ continuation_prompt = "▶▶" - `<color>` - `none` -`<color>` 是颜色说明符(下面解释)。 `fg:<color>` 和 `<color>` 的功能暂时相同,未来可能会更改。 `inverted` 会反转背景和文字的颜色。 字符串中的单词顺序不影响显示结果。 +`<color>` 可以声明颜色,会在下面解释。 `fg:<color>` 和 `<color>` 的功能暂时相同,未来可能会更改。 `inverted` 会反转背景和文字的颜色。 字符串中的单词顺序不影响显示结果。 -若 `none` 不是 `bg:` 的一部分,则它会覆盖其他的设置:比如 `fg:red none fg:blue` 不会更改任何样式。 `bg:none` 会设置成默认背景色,因此 `fg:red bg:none`、`red`、`fg:red` 的作用相同;类似,`bg:green fg:red bg:none`、`fg:red`、`red` 的作用也相同。 未来可能会将 `none` 与其它标识符一起使用视为一种错误。 +若 `none` 不是 `bg:` 的一部分,则它会覆盖其他的设置:比如 `fg:red none fg:blue` 不会更改任何样式。 `bg:none` 会设置成默认背景色,因此 `fg:red bg:none`、`red`、`fg:red` 的作用相同;类似,`bg:green fg:red bg:none`、`fg:red`、`red` 的作用也相同。 未来可能会将 `none` 与其它单词一起使用视为错误。 -颜色说明符可以是以下内容之一: +颜色可以由以下任一内容定义: - 任一标准的终端颜色:`black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`。 您也可以使用前缀 `bright-` 定义浅色版本(例如 `bright-white`)。 - 一个 `#` 后跟一个六位十六进制数。 这将指定一个 [十六进制 RGB 颜色代码](https://www.w3schools.com/colors/colors_hexadecimal.asp)。 @@ -251,8 +277,8 @@ continuation_prompt = "▶▶" 如果为文本/背景指定了多个颜色,字符串中最后指定的颜色将具有最高优先级。 -Not every style string will be displayed correctly by every terminal. In particular, the following known quirks exist: +并非每种类型的字符串都会被每个终端正确显示。 特别地,以下是已知的几种情况: -- Many terminals disable support for `blink` by default -- `hidden` is not supported on iTerm (https://gitlab.com/gnachman/iterm2/-/issues/4564). -- `strikethrough` is not supported by the default macOS Terminal.app +- 许多终端默认禁用对 `blink` 的支持 +- `hidden` 在 iTerm (https://gitlab.com/gnachman/iterm2/-/issues/4564) 上不被支持。 +- `strikethrough` 不被默认 macOS Terminal.app 支持 diff --git a/docs/zh-CN/config/README.md b/docs/zh-CN/config/README.md index d4fdccac7..8a70ea13f 100644 --- a/docs/zh-CN/config/README.md +++ b/docs/zh-CN/config/README.md @@ -125,7 +125,7 @@ Starship 中的大多数组件允许您为其设置显示样式。 显示样式 以下符号在格式字符串中具有特殊用途,必须转义: `$ [ ] ( )`。 -Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). It is recommended to use a literal string (surrounded by single quotes) in your config. If you want to use a basic string (surrounded by double quotes), you must escape the backslash itself (i.e. use `\\`). +Note that TOML has [both basic strings and literal strings](https://toml.io/en/v1.0.0#string). 建议在你的配置中使用字面字符串(由单引号包围)。 如果你想使用一个基本的字符串(由双引号包围),你必须在双引号前面添加反斜杠符号进行转义(即使用\“abc\"输出"abc")。 For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent: @@ -144,9 +144,9 @@ format = ''' \$''' ``` -### Negative matching +### 错误匹配 -Many modules have `detect_extensions`, `detect_files`, and `detect_folders` variables. These take lists of strings to match or not match. "Negative" options, those which should not be matched, are indicated with a leading "!" character. The presence of _any_ negative indicator in the directory will result in the module not being matched. +许多模块都有 detect_extensions, detect_files, 和 detect_folders 变量。 These take lists of strings to match or not match. "Negative" options, those which should not be matched, are indicated with a leading "!" character. The presence of _any_ negative indicator in the directory will result in the module not being matched. Extensions are matched against both the characters after the last dot in a filename, and the characters after the first dot in a filename. For example, `foo.bar.tar.gz` will be matched against `bar.tar.gz` and `gz` in the `detect_extensions` variable. Files whose name begins with a dot are not considered to have extensions at all. @@ -162,13 +162,15 @@ detect_extensions = ["ts", "!video.ts", "!audio.ts"] ### 配置项 -| 选项 | 默认值 | 描述 | -| ----------------- | ----------------------------- | ---------------------------------------------------------------- | -| `format` | [见下文](#default-prompt-format) | 配置提示符的格式。 | -| `right_format` | `""` | See [Enable Right Prompt](/advanced-config/#enable-right-prompt) | -| `scan_timeout` | `30` | Starship 扫描文件的超时时间(单位:毫秒)。 | -| `command_timeout` | `500` | Startship 执行命令的超时时间(单位:毫秒)。 | -| `add_newline` | `true` | 在 shell 提示符之间插入空行。 | +| 选项 | 默认值 | 描述 | +| ----------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `format` | [见下文](#default-prompt-format) | 配置提示符的格式。 | +| `right_format` | `""` | See [Enable Right Prompt](/advanced-config/#enable-right-prompt) | +| `scan_timeout` | `30` | Starship 扫描文件的超时时间(单位:毫秒)。 | +| `command_timeout` | `500` | Startship 执行命令的超时时间(单位:毫秒)。 | +| `add_newline` | `true` | 在 shell 提示符之间插入空行。 | +| `palette` | `""` | Sets which color palette from `palettes` to use. | +| `palettes` | `{}` | Collection of color palettes that assign [colors](/advanced-config/#style-strings) to user-defined names. Note that color palettes cannot reference their own color definitions. | ### 示例 @@ -186,6 +188,16 @@ scan_timeout = 10 # Disable the blank line at the start of the prompt add_newline = false + +# Set "foo" as custom color palette +palette = "foo" + +# Define custom colors +[palettes.foo] +# Overwrite existing color +blue = "21" +# Define new color +mustard = "#af8700" ``` ### 默认提示符格式 @@ -252,6 +264,7 @@ $zig\ $buf\ $nix_shell\ $conda\ +$meson\ $spack\ $memory_usage\ $aws\ @@ -431,12 +444,12 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r `display` 字段的子字段如下: -| 选项 | 默认值 | 描述 | -| -------------------- | ---------- | --------------------------------------------------------------------------------------------------------- | -| `threshold` | `10` | 当前显示设置的电量上限(见示例) | -| `style` | `bold red` | 若组件被显示,则使用此样式 | -| `charging_symbol` | `-` | Optional symbol displayed if display option is in use, defaults to battery's `charging_symbol` option. | -| `discharging_symbol` | `-` | Optional symbol displayed if display option is in use, defaults to battery's `discharging_symbol` option. | +| 选项 | 默认值 | 描述 | +| -------------------- | ------------ | --------------------------------------------------------------------------------------------------------- | +| `threshold` | `10` | 当前显示设置的电量上限(见示例) | +| `style` | `"red bold"` | 若组件被显示,则使用此样式 | +| `charging_symbol` | | Optional symbol displayed if display option is in use, defaults to battery's `charging_symbol` option. | +| `discharging_symbol` | | Optional symbol displayed if display option is in use, defaults to battery's `discharging_symbol` option. | #### 示例 @@ -462,24 +475,24 @@ The `buf` module shows the currently installed version of [Buf](https://buf.buil ### 配置项 -| 选项 | 默认值 | 描述 | -| ------------------- | ------------------------------------------------------------ | ----------------------------------------------------- | -| `format` | `'with [$symbol($version \(Buf $buf_version\) )]($style)'` | The format for the `buf` module. | -| `version_format` | `"v${raw}"` | The version format. | -| `symbol` | `"🦬 "` | The symbol used before displaying the version of Buf. | -| `detect_extensions` | `[]` | Which extensions should trigger this module. | -| `detect_files` | `["buf.yaml", "buf.gen.yaml", "buf.work.yaml"]` | Which filenames should trigger this module. | -| `detect_folders` | `[]` | Which folders should trigger this modules. | -| `style` | `"bold blue"` | 此组件的样式。 | -| `disabled` | `false` | Disables the `elixir` module. | +| 选项 | 默认值 | 描述 | +| ------------------- | ----------------------------------------------- | ----------------------------------------------------- | +| `format` | `"with [$symbol($version )]($style)"` | The format for the `buf` module. | +| `version_format` | `"v${raw}"` | The version format. | +| `symbol` | `"🦬 "` | The symbol used before displaying the version of Buf. | +| `detect_extensions` | `[]` | Which extensions should trigger this module. | +| `detect_files` | `["buf.yaml", "buf.gen.yaml", "buf.work.yaml"]` | Which filenames should trigger this module. | +| `detect_folders` | `[]` | Which folders should trigger this modules. | +| `style` | `"bold blue"` | 此组件的样式。 | +| `disabled` | `false` | Disables the `elixir` module. | ### Variables -| 字段 | 示例 | 描述 | -| ------------- | -------- | -------------------- | -| `buf_version` | `v1.0.0` | The version of `buf` | -| `symbol` | | `symbol`对应值 | -| `style`* | | `style`对应值 | +| 字段 | 示例 | 描述 | +| --------- | -------- | -------------------- | +| `version` | `v1.0.0` | The version of `buf` | +| `symbol` | | `symbol`对应值 | +| `style`* | | `style`对应值 | *: This variable can only be used as a part of a style string @@ -609,9 +622,9 @@ By default it only changes color. If you also want to change its shape take a lo ### Variables -| 字段 | 示例 | 描述 | -| ------ | -- | --------------------------------------------------------------------- | -| symbol | | A mirror of either `success_symbol`, `error_symbol` or `vicmd_symbol` | +| 字段 | 示例 | 描述 | +| ------ | -- | -------------------------------------------------------------------------------------------------------- | +| symbol | | A mirror of either `success_symbol`, `error_symbol`, `vimcmd_symbol` or `vimcmd_replace_one_symbol` etc. | ### Examples @@ -794,12 +807,12 @@ The `container` module displays a symbol and container name, if inside a contain ### 配置项 -| 选项 | 默认值 | 描述 | -| ---------- | -------------------------------------- | ----------------------------------------- | -| `symbol` | `"⬢"` | The symbol shown, when inside a container | -| `style` | `"bold red dimmed"` | 此组件的样式。 | -| `format` | `"[$symbol \\[$name\\]]($style) "` | 组件格式化模板。 | -| `disabled` | `false` | Disables the `container` module. | +| 选项 | 默认值 | 描述 | +| ---------- | ---------------------------------- | ----------------------------------------- | +| `symbol` | `"⬢"` | The symbol shown, when inside a container | +| `style` | `"bold red dimmed"` | 此组件的样式。 | +| `format` | `'[$symbol \[$name\]]($style) '` | 组件格式化模板。 | +| `disabled` | `false` | Disables the `container` module. | ### Variables @@ -817,7 +830,7 @@ The `container` module displays a symbol and container name, if inside a contain # ~/.config/starship.toml [container] -format = "[$symbol \\[$name\\]]($style) " +format = '[$symbol \[$name\]]($style) ' ``` ## Crystal @@ -867,16 +880,16 @@ The `daml` module shows the currently used [Daml](https://www.digitalasset.com/d ### 配置项 -| 选项 | 默认值 | 描述 | -| ------------------- | ---------------------------------- | ------------------------------------------------------------------------- | -| `format` | `via [$symbol($version )]($style)` | 组件格式化模板。 | -| `version_format` | `v${raw}` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | -| `symbol` | `"Λ "` | A format string representing the symbol of Daml | -| `style` | `"bold cyan"` | 此组件的样式。 | -| `detect_extensions` | `[]` | Which extensions should trigger this module. | -| `detect_files` | `["daml.yaml"]` | Which filenames should trigger this module. | -| `detect_folders` | `[]` | Which folders should trigger this module. | -| `disabled` | `false` | Disables the `daml` module. | +| 选项 | 默认值 | 描述 | +| ------------------- | ------------------------------------ | ------------------------------------------------------------------------- | +| `format` | `"via [$symbol($version )]($style)"` | 组件格式化模板。 | +| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | +| `symbol` | `"Λ "` | A format string representing the symbol of Daml | +| `style` | `"bold cyan"` | 此组件的样式。 | +| `detect_extensions` | `[]` | Which extensions should trigger this module. | +| `detect_files` | `["daml.yaml"]` | Which filenames should trigger this module. | +| `detect_folders` | `[]` | Which folders should trigger this module. | +| `disabled` | `false` | Disables the `daml` module. | ### Variables @@ -993,7 +1006,7 @@ format = "via [🦕 $version](green bold) " | `read_only` | `"🔒"` | The symbol indicating current directory is read only. | | `read_only_style` | `"red"` | The style for the read only symbol. | | `truncation_symbol` | `""` | The symbol to prefix to truncated paths. eg: "…/" | -| `repo_root_style` | `None` | The style for the root of the git repo. The default value is equivalent to `style`. | +| `repo_root_style` | | The style for the root of the git repo. The default value is equivalent to `style`. | | `repo_root_format` | `"[$before_root_path]($style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) "` | The format of a git repo when `repo_root_style` is defined. | | `home_symbol` | `"~"` | The symbol indicating home directory. | | `use_os_path_sep` | `true` | Use the OS specific path separator instead of always using `/` (e.g. `\` on Windows) | @@ -1480,16 +1493,16 @@ The `git_commit` module shows the current commit hash and also the tag (if any) ### 配置项 -| 选项 | 默认值 | 描述 | -| -------------------- | ---------------------------------- | ------------------------------------------------------------------------------------ | -| `commit_hash_length` | `7` | 显示的 git 提交哈希值的长度。 | -| `format` | `"[\\($hash$tag\\)]($style) "` | 组件格式化模板。 | -| `style` | `"bold green"` | 此组件的样式。 | -| `only_detached` | `true` | Only show git commit hash when in detached `HEAD` state | -| `tag_disabled` | `true` | Disables showing tag info in `git_commit` module. | -| `tag_max_candidates` | `0` | How many commits to consider for tag display. The default only allows exact matches. | -| `tag_symbol` | `" 🏷 "` | Tag symbol prefixing the info shown | -| `disabled` | `false` | 禁用 `git_commit` 组件。 | +| 选项 | 默认值 | 描述 | +| -------------------- | ------------------------------ | ------------------------------------------------------------------------------------ | +| `commit_hash_length` | `7` | 显示的 git 提交哈希值的长度。 | +| `format` | `'[\($hash$tag\)]($style) '` | 组件格式化模板。 | +| `style` | `"bold green"` | 此组件的样式。 | +| `only_detached` | `true` | Only show git commit hash when in detached `HEAD` state | +| `tag_disabled` | `true` | Disables showing tag info in `git_commit` module. | +| `tag_max_candidates` | `0` | How many commits to consider for tag display. The default only allows exact matches. | +| `tag_symbol` | `" 🏷 "` | Tag symbol prefixing the info shown | +| `disabled` | `false` | 禁用 `git_commit` 组件。 | ### Variables @@ -1567,7 +1580,7 @@ The `git_metrics` module will show the number of added and deleted lines in the | `added_style` | `"bold green"` | The style for the added count. | | `deleted_style` | `"bold red"` | The style for the deleted count. | | `only_nonzero_diffs` | `true` | Render status only for changed items. | -| `format` | `'([+$added]($added_style) )([-$deleted]($deleted_style) )'` | 组件格式化模板。 | +| `format` | `"([+$added]($added_style) )([-$deleted]($deleted_style) )"` | 组件格式化模板。 | | `disabled` | `true` | Disables the `git_metrics` module. | ### Variables @@ -1588,7 +1601,7 @@ The `git_metrics` module will show the number of added and deleted lines in the [git_metrics] added_style = "bold blue" -format = '[+$added]($added_style)/[-$deleted]($deleted_style) ' +format = "[+$added]($added_style)/[-$deleted]($deleted_style) " ``` ## Git Status @@ -1690,7 +1703,7 @@ Use Windows Starship executable on Windows paths in WSL # ~/.config/starship.toml [git_status] -windows_starship = '/mnt/c/Users/username/scoop/apps/starship/current/starship.exe' +windows_starship = "/mnt/c/Users/username/scoop/apps/starship/current/starship.exe" ``` ## Go @@ -1852,21 +1865,21 @@ disabled = false The `java` module shows the currently installed version of [Java](https://www.oracle.com/java/). By default the module will be shown if any of the following conditions are met: -- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `.deps.edn`, `project.clj`, or `build.boot` file +- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, or `build.boot` file - The current directory contains a file with the `.java`, `.class`, `.gradle`, `.jar`, `.clj`, or `.cljc` extension ### 配置项 -| 选项 | 默认值 | 描述 | -| ------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `format` | `"via [${symbol}(${version} )]($style)"` | 组件格式化模板。 | -| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | -| `detect_extensions` | `["java", "class", "gradle", "jar", "cljs", "cljc"]` | Which extensions should trigger this module. | -| `detect_files` | `["pom.xml", "build.gradle.kts", "build.sbt", ".java-version", ".deps.edn", "project.clj", "build.boot"]` | Which filenames should trigger this module. | -| `detect_folders` | `[]` | Which folders should trigger this modules. | -| `symbol` | `"☕ "` | A format string representing the symbol of Java | -| `style` | `"red dimmed"` | 此组件的样式。 | -| `disabled` | `false` | 禁用 `java` 组件。 | +| 选项 | 默认值 | 描述 | +| ------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `format` | `"via [${symbol}(${version} )]($style)"` | 组件格式化模板。 | +| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | +| `detect_extensions` | `["java", "class", "gradle", "jar", "cljs", "cljc"]` | Which extensions should trigger this module. | +| `detect_files` | `["pom.xml", "build.gradle.kts", "build.sbt", ".java-version", "deps.edn", "project.clj", "build.boot"]` | Which filenames should trigger this module. | +| `detect_folders` | `[]` | Which folders should trigger this modules. | +| `symbol` | `"☕ "` | A format string representing the symbol of Java | +| `style` | `"red dimmed"` | 此组件的样式。 | +| `disabled` | `false` | 禁用 `java` 组件。 | ### Variables @@ -2258,6 +2271,45 @@ symbol = " " style = "bold dimmed green" ``` +## Meson + +The `meson` module shows the current Meson developer environment status. + +By default the Meson project name is displayed, if `$MESON_DEVENV` is set. + +### 配置项 + +| 选项 | 默认值 | 描述 | +| ------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------- | +| `truncation_length` | `2^32 - 1` | Truncates a project name to `N` graphemes. | +| `truncation_symbol` | `"…"` | The symbol used to indicate a project name was truncated. You can use `""` for no symbol. | +| `format` | `"via [$symbol$project]($style) "` | 组件格式化模板。 | +| `symbol` | `"⬢ "` | The symbol used before displaying the project name. | +| `style` | `"blue bold"` | 此组件的样式。 | +| `disabled` | `false` | Disables the `meson` module. | + +### Variables + +| 字段 | 示例 | 描述 | +| --------- | ---------- | ------------------------------ | +| project | `starship` | The current Meson project name | +| symbol | `🐏` | `symbol`对应值 | +| style\* | | `style`对应值 | + +*: This variable can only be used as a part of a style string + +### 示例 + +```toml +# ~/.config/starship.toml + +[meson] +disabled = false +truncation_symbol = "--" +symbol = " " +style = "bold dimmed green" +``` + ## Mercurial Branch `hg_branch` 组件显示当前目录的 hg 仓库的活动分支。 @@ -2471,12 +2523,12 @@ The `openstack` module shows the current OpenStack cloud and project. The module ### 配置项 -| 选项 | 默认值 | 描述 | -| ---------- | --------------------------------------------------- | -------------------------------------------------------------- | -| `format` | `"on [$symbol$cloud(\\($project\\))]($style) "` | 组件格式化模板。 | -| `symbol` | `"☁️ "` | The symbol used before displaying the current OpenStack cloud. | -| `style` | `"bold yellow"` | 此组件的样式。 | -| `disabled` | `false` | Disables the `openstack` module. | +| 选项 | 默认值 | 描述 | +| ---------- | ----------------------------------------------- | -------------------------------------------------------------- | +| `format` | `'on [$symbol$cloud(\($project\))]($style) '` | 组件格式化模板。 | +| `symbol` | `"☁️ "` | The symbol used before displaying the current OpenStack cloud. | +| `style` | `"bold yellow"` |