mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
docs(i18n): new Crowdin updates (#3218)
This commit is contained in:
@@ -43,11 +43,11 @@ function Invoke-Starship-PreCommand {
|
||||
}
|
||||
```
|
||||
|
||||
## Change Window Title
|
||||
## 更改窗口标题
|
||||
|
||||
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
|
||||
一些 shell 会自动更改您的窗口标题(比如改成您的工作目录)。 Fish 甚至默认会执行此功能。 Starship 没有实现此功能,但将这个功能添加到 `bash` 或 `zsh` 是相当简单的。
|
||||
|
||||
First, define a window title change function (identical in bash and zsh):
|
||||
首先,定义窗口标题更改函数(在 bash 和 zsh 中相同):
|
||||
|
||||
```bash
|
||||
function set_win_title(){
|
||||
@@ -55,23 +55,23 @@ function set_win_title(){
|
||||
}
|
||||
```
|
||||
|
||||
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
|
||||
您可以使用变量来定制标题(常用的有 `$USER`,`$HOSTNAME` 和 `$PWD`)。
|
||||
|
||||
In `bash`, set this function to be the precmd starship function:
|
||||
在 `bash` 中,设置此函数为 starship 预执行函数:
|
||||
|
||||
```bash
|
||||
starship_precmd_user_func="set_win_title"
|
||||
```
|
||||
|
||||
In `zsh`, add this to the `precmd_functions` array:
|
||||
在 `zsh`中,将此函数添加到 `reservmd_functions` 列表:
|
||||
|
||||
```bash
|
||||
precmd_functions+=(set_win_title)
|
||||
```
|
||||
|
||||
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
|
||||
如果您对产生的效果感到满意,请将以上代码添加到您的 shell 配置文件(`~/.bashrc` 或 `~/zsrhc`)中以使其永久化。
|
||||
|
||||
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
|
||||
例如,如果您想要在终端标签标题中显示当前目录, 将以下代码添加到您的 `~/.ashrc` 或 `~/.zshrc`:
|
||||
|
||||
```bash
|
||||
function set_win_title(){
|
||||
@@ -91,9 +91,9 @@ function Invoke-Starship-PreCommand {
|
||||
Invoke-Expression (&starship init powershell)
|
||||
```
|
||||
|
||||
## Enable Right Prompt
|
||||
## 启用右侧提示
|
||||
|
||||
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
|
||||
一些 Shell 支持右侧提示, 它与输入区渲染在同一行。 Starship 可以设置右侧提示的内容,使用 `right_format` 选项。 Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
|
||||
|
||||
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [fill module](/config/#fill).
|
||||
|
||||
@@ -120,7 +120,7 @@ Produces a prompt like the following:
|
||||
|
||||
## 样式设定
|
||||
|
||||
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
|
||||
样式字符串是用空格分隔的单词列表。 其中单词不是大小写敏感的(例如 `bold` 和 `BoLd` 被视为同一字符串)。 每个单词可以是以下之一:
|
||||
|
||||
- `bold`
|
||||
- `italic`
|
||||
@@ -132,14 +132,14 @@ Style strings are a list of words, separated by whitespace. The words are not ca
|
||||
- `<color>`
|
||||
- `none`
|
||||
|
||||
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
|
||||
`<color>` 是颜色说明符(下面解释)。 `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. 字符串中的单词顺序不影响显示结果。
|
||||
|
||||
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
|
||||
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. 未来可能会将 `none` 与其它标识符一起使用视为一种错误。
|
||||
|
||||
A color specifier can be one of the following:
|
||||
颜色说明符可以是以下内容之一:
|
||||
|
||||
- 标准终端颜色之一:`black`,`red`,`green`,`blue`,`yellow`,`purple`,`cyan`,`white`。 您可以使用可选前缀 `bright-` 来获取明亮版本的颜色(例如,`bright-white`)。
|
||||
- 一个 `#` 后跟一个六位十六进制数。 这将指定一个 [十六进制 RGB 颜色代码](https://www.w3schools.com/colors/colors_hexadecimal.asp)。
|
||||
- 0-255 之间的数字。 这将指定一个 [8 位 ANSI 颜色码](https://i.stack.imgur.com/KTSQa.png)。
|
||||
|
||||
If multiple colors are specified for foreground/background, the last one in the string will take priority.
|
||||
如果为文本/背景指定了多个颜色,字符串中最后指定的颜色将具有最高优先级。
|
||||
|
||||
+236
-165
@@ -61,7 +61,7 @@ Format strings are the format that a module prints all its variables with. Most
|
||||
|
||||
#### 字段
|
||||
|
||||
A variable contains a `$` symbol followed by the name of the variable. The name of a variable only contains letters, numbers and `_`.
|
||||
A variable contains a `$` symbol followed by the name of the variable. The name of a variable can only contain letters, numbers and `_`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -106,18 +106,11 @@ For example:
|
||||
- `(some text)` will always show nothing since there are no variables wrapped in the braces.
|
||||
- When `$all` is a shortcut for `\[$a$b\]`, `($all)` will show nothing only if `$a` and `$b` are both `None`. This works the same as `(\[$a$b\] )`.
|
||||
|
||||
#### Escapable characters
|
||||
#### Special characters
|
||||
|
||||
The following symbols have special usage in a format string. If you want to print the following symbols, you have to escape them with a backslash (`\`).
|
||||
The following symbols have special usage in a format string and must be escaped: `$ \ [ ] ( )`.
|
||||
|
||||
- \$
|
||||
- \\
|
||||
- [
|
||||
- ]
|
||||
- (
|
||||
- )
|
||||
|
||||
Note that `toml` has [its own escape syntax](https://github.com/toml-lang/toml#user-content-string). It is recommended to use a literal string (`''`) in your config. If you want to use a basic string (`""`), pay attention to escape the backslash `\`.
|
||||
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 `\\`).
|
||||
|
||||
For example, when you want to print a `$` symbol on a new line, the following configs for `format` are equivalent:
|
||||
|
||||
@@ -231,9 +224,11 @@ $memory_usage\
|
||||
$aws\
|
||||
$gcloud\
|
||||
$openstack\
|
||||
$azure\
|
||||
$env_var\
|
||||
$crystal\
|
||||
$custom\
|
||||
$sudo\
|
||||
$cmd_duration\
|
||||
$line_break\
|
||||
$jobs\
|
||||
@@ -325,22 +320,47 @@ style = "bold blue"
|
||||
symbol = "🅰 "
|
||||
```
|
||||
|
||||
## Battery
|
||||
## Azure
|
||||
|
||||
`battery` 组件显示电池充电情况和当前充电状态。 这个组件只会在当前电量低于 10% 时显示。
|
||||
The `azure` module shows the current Azure Subscription. This is based on showing the name of the default subscription, as defined in the `~/.azure/azureProfile.json` file.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | --------------------------------- | ---------------- |
|
||||
| `full_symbol` | `" "` | 显示于电池充满时。 |
|
||||
| `charging_symbol` | `" "` | 显示于正在充电时。 |
|
||||
| `discharging_symbol` | `" "` | 显示于电池放电时。 |
|
||||
| `unknown_symbol` | `" "` | 显示于电池状态未知时 |
|
||||
| `empty_symbol` | `" "` | 显示于电池状态为空时 |
|
||||
| `format` | `"[$symbol$percentage]($style) "` | 组件格式化模板。 |
|
||||
| `display` | [见下文](#battery-display) | 电量显示阈值和样式。 |
|
||||
| `disabled` | `false` | 禁用 `battery` 组件。 |
|
||||
| 字段 | 默认值 | 描述 |
|
||||
| ---------- | ---------------------------------------- | ------------------------------------------ |
|
||||
| `format` | `"on [$symbol($subscription)]($style) "` | The format for the Azure module to render. |
|
||||
| `symbol` | `"ﴃ "` | The symbol used in the format. |
|
||||
| `style` | `"blue bold"` | The style used in the format. |
|
||||
| `disabled` | `true` | Disables the `azure` module. |
|
||||
|
||||
### 示例
|
||||
|
||||
```toml
|
||||
# ~/.config/starship.toml
|
||||
|
||||
[azure]
|
||||
disabled = false
|
||||
format = "on [$symbol($subscription)]($style) "
|
||||
symbol = "ﴃ "
|
||||
style = "blue bold"
|
||||
```
|
||||
|
||||
## Battery
|
||||
|
||||
The `battery` module shows how charged the device's battery is and its current charging status. The module is only visible when the device's battery is below 10%.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | --------------------------------- | --------------------------------------------------- |
|
||||
| `full_symbol` | `" "` | The symbol shown when the battery is full. |
|
||||
| `charging_symbol` | `" "` | The symbol shown when the battery is charging. |
|
||||
| `discharging_symbol` | `" "` | The symbol shown when the battery is discharging. |
|
||||
| `unknown_symbol` | `" "` | The symbol shown when the battery state is unknown. |
|
||||
| `empty_symbol` | `" "` | The symbol shown when the battery state is empty. |
|
||||
| `format` | `"[$symbol$percentage]($style) "` | 组件格式化模板。 |
|
||||
| `display` | [见下文](#battery-display) | Display threshold and style for the module. |
|
||||
| `disabled` | `false` | Disables the `battery` module. |
|
||||
|
||||
### 示例
|
||||
|
||||
@@ -353,9 +373,9 @@ charging_symbol = "⚡️ "
|
||||
discharging_symbol = "💀 "
|
||||
```
|
||||
|
||||
### Battery 组件的显示
|
||||
### Battery Display
|
||||
|
||||
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). 如果 `display` 没有设置, 默认设置如下:
|
||||
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. 默认设置如下:
|
||||
|
||||
```toml
|
||||
[[battery.display]]
|
||||
@@ -367,12 +387,12 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
|
||||
|
||||
#### 配置项
|
||||
|
||||
`display` 字段的子字段如下:
|
||||
The `display` option is an array of the following table.
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | ---------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| `threshold` | `10` | 当前显示设置的电量上限(见示例) |
|
||||
| `style` | `bold red` | 若组件被显示,则使用此样式 |
|
||||
| `threshold` | `10` | The upper bound for the display option. |
|
||||
| `style` | `bold red` | The style used if the display option is in use. |
|
||||
| `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. |
|
||||
|
||||
@@ -394,9 +414,9 @@ discharging_symbol = "💦"
|
||||
|
||||
## Character
|
||||
|
||||
`character` 组件用于在您输入终端的文本旁显示一个字符(通常是一个箭头)。
|
||||
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
|
||||
|
||||
这个字符可以告诉您最后一个命令是否执行成功。 It can do this in two ways:
|
||||
The character will tell you whether the last command was successful or not. It can do this in two ways:
|
||||
|
||||
- changing color (`red`/`green`)
|
||||
- changing shape (`❯`/`✖`)
|
||||
@@ -423,7 +443,7 @@ By default it only changes color. If you also want to change its shape take a lo
|
||||
| `success_symbol` | `"[❯](bold green)"` | The format string used before the text input if the previous command succeeded. |
|
||||
| `error_symbol` | `"[❯](bold red)"` | The format string used before the text input if the previous command failed. |
|
||||
| `vicmd_symbol` | `"[❮](bold green)"` | The format string used before the text input if the shell is in vim normal mode. |
|
||||
| `disabled` | `false` | 禁用 `character` 组件。 |
|
||||
| `disabled` | `false` | Disables the `character` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -524,27 +544,27 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
|
||||
|
||||
## Command Duration
|
||||
|
||||
`cmd_duration` 组件显示上一个命令执行的时间。 此组件只在命令执行时间长于两秒时显示,或者当其 `min_time` 字段被设置时,按此值为执行时间的显示下限。
|
||||
The `cmd_duration` module shows how long the last command took to execute. The module will be shown only if the command took longer than two seconds, or the `min_time` config value, if it exists.
|
||||
|
||||
::: warning 不要在 Bash 里捕获 DEBUG 信号
|
||||
::: warning Do not hook the DEBUG trap in Bash
|
||||
|
||||
如果您正在 `bash` 上使用 Starship,在运行 `eval $(starship)` 后,不要捕获 `DEBUG` 信号,否则此组件**将会**坏掉。
|
||||
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
|
||||
|
||||
:::
|
||||
|
||||
需要在自动每一条命令前执行某些操作的 Bash 用户可以使用 [rcaloras 的 bash_preexec 框架](https://github.com/rcaloras/bash-preexec)。 只需要在执行 `eval $(starship init $0)` 前简单地定义 `preexec_functions` 和 `precmd_functions` 两个列表,就可以照常运行了。
|
||||
Bash users who need preexec-like functionality can use [rcaloras's bash_preexec framework](https://github.com/rcaloras/bash-preexec). Simply define the arrays `preexec_functions` and `precmd_functions` before running `eval $(starship init $0)`, and then proceed as normal.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | ----------------------------- | ----------------------------------------------------- |
|
||||
| `min_time` | `2_000` | 显示此组件所需的最短执行时长(单位:毫秒)。 |
|
||||
| `show_milliseconds` | `false` | 除了秒数外在执行时长中额外显示毫秒。 |
|
||||
| `format` | `"took [$duration]($style) "` | 组件格式化模板。 |
|
||||
| `style` | `"bold yellow"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `cmd_duration` 组件。 |
|
||||
| `show_notifications` | `false` | Show desktop notifications when command completes. |
|
||||
| `min_time_to_notify` | `45_000` | Shortest duration for notification (in milliseconds). |
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | ----------------------------- | ---------------------------------------------------------- |
|
||||
| `min_time` | `2_000` | Shortest duration to show time for (in milliseconds). |
|
||||
| `show_milliseconds` | `false` | Show milliseconds in addition to seconds for the duration. |
|
||||
| `format` | `"took [$duration]($style) "` | 组件格式化模板。 |
|
||||
| `style` | `"bold yellow"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | Disables the `cmd_duration` module. |
|
||||
| `show_notifications` | `false` | Show desktop notifications when command completes. |
|
||||
| `min_time_to_notify` | `45_000` | Shortest duration for notification (in milliseconds). |
|
||||
|
||||
::: tip
|
||||
|
||||
@@ -577,20 +597,20 @@ The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) e
|
||||
|
||||
::: tip
|
||||
|
||||
此组件没有禁用 conda 自带的提示符修改,您可能需要执行 `conda config --set changeps1 False`。
|
||||
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
|
||||
|
||||
:::
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `truncation_length` | `1` | 如果这个 conda 环境是通过 `conda create -p [path]` 创建的,环境路径的目录深度应该被截断到此数量。 `0` 表示不用截断。 另请参阅 [`directory`](#directory) 组件。 |
|
||||
| `symbol` | `"🅒 "` | 在环境名之前显示的符号。 |
|
||||
| `style` | `"bold green"` | 此组件的样式。 |
|
||||
| `format` | `"via [$symbol$environment]($style) "` | 组件格式化模板。 |
|
||||
| `ignore_base` | `true` | Ignores `base` environment when activated. |
|
||||
| `disabled` | `false` | 禁用 `conda` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `truncation_length` | `1` | The number of directories the environment path should be truncated to, if the environment was created via `conda create -p [path]`. `0` means no truncation. Also see the [`directory`](#directory) module. |
|
||||
| `symbol` | `"🅒 "` | The symbol used before the environment name. |
|
||||
| `style` | `"bold green"` | 此组件的样式。 |
|
||||
| `format` | `"via [$symbol$environment]($style) "` | 组件格式化模板。 |
|
||||
| `ignore_base` | `true` | Ignores `base` environment when activated. |
|
||||
| `disabled` | `false` | Disables the `conda` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -615,7 +635,7 @@ format = "[$symbol$environment](dimmed green) "
|
||||
|
||||
The `crystal` module shows the currently installed version of [Crystal](https://crystal-lang.org/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `shard.yml` 文件
|
||||
- The current directory contains a `shard.yml` file
|
||||
- The current directory contains a `.cr` file
|
||||
|
||||
### 配置项
|
||||
@@ -656,7 +676,7 @@ The `dart` module shows the currently installed version of [Dart](https://dart.d
|
||||
|
||||
- The current directory contains a file with `.dart` extension
|
||||
- The current directory contains a `.dart_tool` directory
|
||||
- 当前目录包含 `pubspec.yaml`,`pubspec.yml` 或 `pubspec.lock` 文件
|
||||
- The current directory contains a `pubspec.yaml`, `pubspec.yml` or `pubspec.lock` file
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -727,21 +747,21 @@ format = "via [🦕 $version](green bold) "
|
||||
|
||||
## Directory
|
||||
|
||||
`directory` 组件显示当前目录的路径,显示的路径会截断到三个父目录以内。 如果您处于一个 git 仓库中,显示的路径则最多会截断到该仓库的根目录。
|
||||
The `directory` module shows the path to your current directory, truncated to three parent folders. Your directory will also be truncated to the root of the git repo that you're currently in.
|
||||
|
||||
当使用 fish 风格的当前目录显示样式时,您会看到基于您的设置的每个上级目录的短名称,而不是隐藏被截断的上级目录。
|
||||
When using the fish style pwd option, instead of hiding the path that is truncated, you will see a shortened name of each directory based on the number you enable for the option.
|
||||
|
||||
例如,对于 `~/Dev/Nix/nixpkgs/pkgs`,其中 `nixpkgs` 是 git 仓库根目录,fish 风格相关选项设置为 `1`。 您将会看到 `~/D/N/nixpkgs/pkgs`,而在设置 fish 风格之前,当前路径将显示成 `nixpkgs/pkgs`。
|
||||
For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, and the option set to `1`. You will now see `~/D/N/nixpkgs/pkgs`, whereas before it would have been `nixpkgs/pkgs`.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `truncation_length` | `3` | 当前目录路径被截断后最多保留的父目录数量。 |
|
||||
| `truncate_to_repo` | `true` | 是否只截断到您当前处于的 git 仓库根目录下。 |
|
||||
| `truncation_length` | `3` | The number of parent folders that the current directory should be truncated to. |
|
||||
| `truncate_to_repo` | `true` | Whether or not to truncate to the root of the git repo that you're currently in. |
|
||||
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | 组件格式化模板。 |
|
||||
| `style` | `"bold cyan"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `directory` 组件。 |
|
||||
| `disabled` | `false` | Disables the `directory` module. |
|
||||
| `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: "…/" |
|
||||
@@ -749,12 +769,12 @@ format = "via [🦕 $version](green bold) "
|
||||
| `home_symbol` | `"~"` | The symbol indicating home directory. |
|
||||
|
||||
<details>
|
||||
<summary>此组件有几个高级配置选项来控制当前目录路径的显示方式。</summary>
|
||||
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
|
||||
|
||||
| Advanced Option | 默认值 | 描述 |
|
||||
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `substitutions` | | A table of substitutions to be made to the path. |
|
||||
| `fish_style_pwd_dir_length` | `0` | 使用 fish shell 当前目录路径逻辑时每个省略目录名使用的字符数。 |
|
||||
| `fish_style_pwd_dir_length` | `0` | The number of characters to use when applying fish shell pwd path logic. |
|
||||
| `use_logical_path` | `true` | If `true` render the logical path sourced from the shell via `PWD` or `--logical-path`. If `false` instead render the physical filesystem path with symlinks resolved. |
|
||||
|
||||
`substitutions` allows you to define arbitrary replacements for literal strings that occur in the path, for example long network prefixes or development directories (i.e. Java). Note that this will disable the fish style PWD.
|
||||
@@ -826,7 +846,7 @@ format = "via [🐋 $context](blue bold)"
|
||||
|
||||
## Dotnet
|
||||
|
||||
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. 如果当前目录已被绑定了一个版本的 SDK,则显示被帮定的版本。 否则此组件将显示最新安装的 SDK 版本。
|
||||
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. If the SDK has been pinned in the current directory, the pinned version is shown. Otherwise the module shows the latest installed version of the SDK.
|
||||
|
||||
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
|
||||
|
||||
@@ -841,7 +861,7 @@ By default this module will only be shown in your prompt when one or more of the
|
||||
|
||||
You'll also need the .NET Core SDK installed in order to use it correctly.
|
||||
|
||||
在内部,此组件使用自己的版本检测机制。 一般来说此组件是直接执行 `dotnet --version` 的两倍快,但当你的 .NET 项目使用了不常见的目录布局时此组件可能显示一个错误的版本。 如果相比于速度您更需要正确的版本号,您可以在组件设置中设置 `heuristic = false` 来禁用该机制。
|
||||
Internally, this module uses its own mechanism for version detection. Typically it is twice as fast as running `dotnet --version`, but it may show an incorrect version if your .NET project has an unusual directory layout. If accuracy is more important than speed, you can disable the mechanism by setting `heuristic = false` in the module options.
|
||||
|
||||
The module will also show the Target Framework Moniker (<https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-framework-versions>) when there is a csproj file in the current directory.
|
||||
|
||||
@@ -851,13 +871,13 @@ The module will also show the Target Framework Moniker (<https://docs.microsoft.
|
||||
| ------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `format` | `"via [$symbol($version )(🎯 $tfm )]($style)"` | 组件格式化模板。 |
|
||||
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||
| `symbol` | `".NET "` | 这个字段的内容会显示在当前 .NET 版本之前。 |
|
||||
| `heuristic` | `true` | 使用更快的版本探测机制以保证 starship 的运行速度。 |
|
||||
| `symbol` | `".NET "` | The symbol used before displaying the version of dotnet. |
|
||||
| `heuristic` | `true` | Use faster version detection to keep starship snappy. |
|
||||
| `detect_extensions` | `["csproj", "fsproj", "xproj"]` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `["global.json", "project.json", "Directory.Build.props", "Directory.Build.targets", "Packages.props"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this modules. |
|
||||
| `style` | `"bold blue"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `dotnet` 组件。 |
|
||||
| `disabled` | `false` | Disables the `dotnet` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -885,7 +905,7 @@ heuristic = false
|
||||
|
||||
The `elixir` module shows the currently installed version of [Elixir](https://elixir-lang.org/) and [Erlang/OTP](https://erlang.org/doc/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `mix.exs` 文件.
|
||||
- The current directory contains a `mix.exs` file.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -924,8 +944,8 @@ symbol = "🔮 "
|
||||
|
||||
The `elm` module shows the currently installed version of [Elm](https://elm-lang.org/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `elm.json` 文件
|
||||
- 当前目录包含 `elm-package.json` 文件
|
||||
- The current directory contains a `elm.json` file
|
||||
- The current directory contains a `elm-package.json` file
|
||||
- The current directory contains a `.elm-version` file
|
||||
- The current directory contains a `elm-stuff` folder
|
||||
- The current directory contains a `*.elm` files
|
||||
@@ -964,10 +984,10 @@ format = "via [ $version](cyan bold) "
|
||||
|
||||
## Environment Variable
|
||||
|
||||
The `env_var` module displays the current value of a selected environment variables. 此组件只有满足以下条件之一时才会被显示:
|
||||
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
|
||||
|
||||
- 设置的 `variable` 是一个已存在的环境变量
|
||||
- 未定义 `variable`,但定义了 `default`
|
||||
- The `variable` configuration option matches an existing environment variable
|
||||
- The `variable` configuration option is not defined, but the `default` configuration option is
|
||||
|
||||
|
||||
::: tip Multiple environmental variables can be displayed by using a `.`. (see example) If the `variable` configuration option is not set, the module will display value of variable under the name of text after the `.` character.
|
||||
@@ -983,13 +1003,13 @@ default = "unknown user"
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | ------------------------------ | ------------------- |
|
||||
| `symbol` | `""` | 这个字段的内容会显示在环境变量值之前。 |
|
||||
| `variable` | | 要显示的环境变量。 |
|
||||
| `default` | | 所选变量未定义时显示的默认值。 |
|
||||
| `format` | `"with [$env_value]($style) "` | 组件格式化模板。 |
|
||||
| `disabled` | `false` | 禁用 `env_var` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | ------------------------------ | ---------------------------------------------------------------------------- |
|
||||
| `symbol` | `""` | The symbol used before displaying the variable value. |
|
||||
| `variable` | | The environment variable to be displayed. |
|
||||
| `default` | | The default value to be displayed when the selected variable is not defined. |
|
||||
| `format` | `"with [$env_value]($style) "` | 组件格式化模板。 |
|
||||
| `disabled` | `false` | Disables the `env_var` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1026,8 +1046,8 @@ default = "unknown user"
|
||||
|
||||
The `erlang` module shows the currently installed version of [Erlang/OTP](https://erlang.org/doc/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `rebar.config` 文件.
|
||||
- 当前目录包含 `erlang.mk` 文件.
|
||||
- The current directory contains a `rebar.config` file.
|
||||
- The current directory contains a `erlang.mk` file.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1154,20 +1174,20 @@ asia-northeast1 = "an1"
|
||||
|
||||
## Git Branch
|
||||
|
||||
`git_branch` 组件显示当前目录的 git 仓库的活动分支。
|
||||
The `git_branch` module shows the active branch of the repo in your current directory.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | -------------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| `always_show_remote` | `false` | Shows the remote tracking branch name, even if it is equal to the local branch name. |
|
||||
| `format` | `"on [$symbol$branch]($style) "` | 组件格式化模板。 Use `"$branch"` to refer to the current branch name. |
|
||||
| `symbol` | `" "` | A format string representing the symbol of git branch. |
|
||||
| `style` | `"bold purple"` | 此组件的样式。 |
|
||||
| `truncation_length` | `2^63 - 1` | Truncates a git branch to `N` graphemes. |
|
||||
| `truncation_symbol` | `"…"` | 此字段的内容用来表示分支名称被截断。 You can use `""` for no symbol. |
|
||||
| `only_attached` | `false` | Only show the branch name when not in a detached `HEAD` state. |
|
||||
| `disabled` | `false` | 禁用 `git_branch` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | -------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `always_show_remote` | `false` | Shows the remote tracking branch name, even if it is equal to the local branch name. |
|
||||
| `format` | `"on [$symbol$branch]($style) "` | 组件格式化模板。 Use `"$branch"` to refer to the current branch name. |
|
||||
| `symbol` | `" "` | A format string representing the symbol of git branch. |
|
||||
| `style` | `"bold purple"` | 此组件的样式。 |
|
||||
| `truncation_length` | `2^63 - 1` | Truncates a git branch to `N` graphemes. |
|
||||
| `truncation_symbol` | `"…"` | The symbol used to indicate a branch name was truncated. You can use `""` for no symbol. |
|
||||
| `only_attached` | `false` | Only show the branch name when not in a detached `HEAD` state. |
|
||||
| `disabled` | `false` | Disables the `git_branch` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1200,13 +1220,13 @@ The `git_commit` module shows the current commit hash and also the tag (if any)
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| -------------------- | ---------------------------------- | ------------------------------------------------------- |
|
||||
| `commit_hash_length` | `7` | 显示的 git 提交哈希值的长度。 |
|
||||
| `commit_hash_length` | `7` | The length of the displayed git commit hash. |
|
||||
| `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_symbol` | `" 🏷 "` | Tag symbol prefixing the info shown |
|
||||
| `disabled` | `false` | 禁用 `git_commit` 组件。 |
|
||||
| `disabled` | `false` | Disables the `git_commit` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1229,7 +1249,7 @@ tag_symbol = "🔖 "
|
||||
|
||||
## Git State
|
||||
|
||||
`git_state` 组件会显示当前目录在哪个 git 仓库中,以及正在进行的操作,例如:_REBASING_,_BISECTING_ 等。 进度信息(例如 REBASING 3/10)如果存在则也会被显示。
|
||||
The `git_state` module will show in directories which are part of a git repository, and where there is an operation in progress, such as: _REBASING_, _BISECTING_, etc. If there is progress information (e.g., REBASING 3/10), that information will be shown too.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1244,7 +1264,7 @@ tag_symbol = "🔖 "
|
||||
| `am_or_rebase` | `"AM/REBASE"` | A format string displayed when an ambiguous `apply-mailbox` or `rebase` is in progress. |
|
||||
| `style` | `"bold yellow"` | 此组件的样式。 |
|
||||
| `format` | `'\([$state( $progress_current/$progress_total)]($style)\) '` | 组件格式化模板。 |
|
||||
| `disabled` | `false` | 禁用 `git_state` 模块 |
|
||||
| `disabled` | `false` | Disables the `git_state` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1273,7 +1293,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -1310,14 +1330,14 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
|
||||
|
||||
## Git Status
|
||||
|
||||
`git_status`组件通过相应的符号显示您当前目录中 git 仓库的状态。
|
||||
The `git_status` module shows symbols representing the state of the repo in your current directory.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------ | ----------------------------------------------- | ----------------------------------- |
|
||||
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
|
||||
| `conflicted` | `"="` | 这个分支有合并冲突。 |
|
||||
| `conflicted` | `"="` | This branch has merge conflicts. |
|
||||
| `ahead` | `"⇡"` | The format of `ahead` |
|
||||
| `behind` | `"⇣"` | The format of `behind` |
|
||||
| `diverged` | `"⇕"` | The format of `diverged` |
|
||||
@@ -1329,7 +1349,7 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
|
||||
| `renamed` | `"»"` | The format of `renamed` |
|
||||
| `deleted` | `"✘"` | The format of `deleted` |
|
||||
| `style` | `"bold red"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `git_status` 组件。 |
|
||||
| `disabled` | `false` | Disables the `git_status` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1359,9 +1379,9 @@ The following variables can be used in `diverged`:
|
||||
|
||||
The following variables can be used in `conflicted`, `ahead`, `behind`, `untracked`, `stashed`, `modified`, `staged`, `renamed` and `deleted`:
|
||||
|
||||
| 字段 | 描述 |
|
||||
| ------- | --------- |
|
||||
| `count` | 显示相应的文件数量 |
|
||||
| 字段 | 描述 |
|
||||
| ------- | ------------------------ |
|
||||
| `count` | Show the number of files |
|
||||
|
||||
### 示例
|
||||
|
||||
@@ -1397,14 +1417,14 @@ behind = "⇣${count}"
|
||||
|
||||
The `golang` module shows the currently installed version of [Go](https://golang.org/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `go.mod` 文件
|
||||
- 当前目录包含 `go.sum` 文件
|
||||
- 当前目录包含 `glide.yaml` 文件
|
||||
- 当前目录包含 `Gopkg.yml` 文件
|
||||
- 当前目录包含 `Gopkg.lock` 文件
|
||||
- The current directory contains a `go.mod` file
|
||||
- The current directory contains a `go.sum` file
|
||||
- The current directory contains a `glide.yaml` file
|
||||
- The current directory contains a `Gopkg.yml` file
|
||||
- The current directory contains a `Gopkg.lock` file
|
||||
- The current directory contains a `.go-version` file
|
||||
- 当前目录包含 `Godeps` 目录
|
||||
- 当前目录包含一个使用 `.go` 扩展名的文件
|
||||
- The current directory contains a `Godeps` directory
|
||||
- The current directory contains a file with the `.go` extension
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1417,7 +1437,7 @@ The `golang` module shows the currently installed version of [Go](https://golang
|
||||
| `detect_files` | `["go.mod", "go.sum", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. |
|
||||
| `style` | `"bold cyan"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `golang` 组件。 |
|
||||
| `disabled` | `false` | Disables the `golang` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1442,7 +1462,7 @@ format = "via [🏎💨 $version](bold cyan) "
|
||||
|
||||
The `helm` module shows the currently installed version of [Helm](https://helm.sh/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `helmfile.yaml` 文件
|
||||
- The current directory contains a `helmfile.yaml` file
|
||||
- The current directory contains a `Chart.yaml` file
|
||||
|
||||
### 配置项
|
||||
@@ -1479,17 +1499,17 @@ format = "via [⎈ $version](bold white) "
|
||||
|
||||
## Hostname
|
||||
|
||||
`hostname` 组件显示系统主机名。
|
||||
The `hostname` module shows the system hostname.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | --------------------------- | ------------------------------------------------------------------ |
|
||||
| `ssh_only` | `true` | 仅在连接到 SSH 会话时显示主机名。 |
|
||||
| `trim_at` | `"."` | 当主机名过长被截断时,会截断成第一次匹配该字符串之前的主机名。 `"."` 会让主机名截断到第一个点处。 `""` 会禁用任何截断。 |
|
||||
| `format` | `"[$hostname]($style) in "` | 组件格式化模板。 |
|
||||
| `style` | `"bold dimmed green"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `hostname` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `ssh_only` | `true` | Only show hostname when connected to an SSH session. |
|
||||
| `trim_at` | `"."` | String that the hostname is cut off at, after the first match. `"."` will stop after the first dot. `""` will disable any truncation |
|
||||
| `format` | `"[$hostname]($style) in "` | 组件格式化模板。 |
|
||||
| `style` | `"bold dimmed green"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | Disables the `hostname` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1530,7 +1550,7 @@ The `java` module shows the currently installed version of [Java](https://www.or
|
||||
| `detect_folders` | `[]` | Which folders should trigger this modules. |
|
||||
| `symbol` | `"☕ "` | A format string representing the symbol of Java |
|
||||
| `style` | `"red dimmed"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `java` 组件。 |
|
||||
| `disabled` | `false` | Disables the `java` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1553,7 +1573,7 @@ symbol = "🌟 "
|
||||
|
||||
## Jobs
|
||||
|
||||
`jobs` 组件显示当前正在运行的任务数量。 仅当有后台任务运行时,此组件才会显示。 The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to *always* show the symbol and number of jobs, even if there are 0 jobs running.
|
||||
The `jobs` module shows the current number of jobs running. The module will be shown only if there are background jobs running. The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to *always* show the symbol and number of jobs, even if there are 0 jobs running.
|
||||
|
||||
The default functionality is:
|
||||
|
||||
@@ -1577,13 +1597,13 @@ The `threshold` option is deprecated, but if you want to use it, the module will
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------ | ----------------------------- | ------------------------------------------------------------------------ |
|
||||
| `threshold`\* | `1` | 如果超过此字段的值,显示任务数量。 |
|
||||
| `threshold`\* | `1` | Show number of jobs if exceeded. |
|
||||
| `symbol_threshold` | `1` | Show `symbol` if the job count is at least `symbol_threshold`. |
|
||||
| `number_threshold` | `2` | Show the number of jobs if the job count is at least `number_threshold`. |
|
||||
| `format` | `"[$symbol$number]($style) "` | 组件格式化模板。 |
|
||||
| `symbol` | `"✦"` | The string used to represent the `symbol` variable. |
|
||||
| `style` | `"bold blue"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `jobs` 组件。 |
|
||||
| `disabled` | `false` | Disables the `jobs` module. |
|
||||
\*: This option is deprecated, please use the
|
||||
|
||||
`number_threshold` and `symbol_threshold` options instead.
|
||||
@@ -1702,7 +1722,7 @@ Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/co
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -1764,13 +1784,13 @@ Long and automatically generated cluster names can be identified and shortened u
|
||||
|
||||
## Line Break
|
||||
|
||||
`line_break` 组件将提示分隔为两行。
|
||||
The `line_break` module separates the prompt into two lines.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | ------- | --------------------------- |
|
||||
| `disabled` | `false` | 禁用 `line_break` 组件,使提示成为单行。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ---------- | ------- | ------------------------------------------------------------------ |
|
||||
| `disabled` | `false` | Disables the `line_break` module, making the prompt a single line. |
|
||||
|
||||
### 示例
|
||||
|
||||
@@ -1824,25 +1844,25 @@ format = "via [🌕 $version](bold blue) "
|
||||
|
||||
## Memory Usage
|
||||
|
||||
`memory_usage` 组件显示当前系统内存和交换区使用情况。
|
||||
The `memory_usage` module shows current system memory and swap usage.
|
||||
|
||||
默认情况下,如果系统交换区使用不为 0,则会显示交换区使用情况。
|
||||
By default the swap usage is displayed if the total system swap is non-zero.
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ----------- | ----------------------------------------------- | ---------------------- |
|
||||
| `threshold` | `75` | 隐藏内存使用情况,除非它超过这个百分比。 |
|
||||
| `format` | `"via $symbol [${ram}( \| ${swap})]($style) "` | 组件格式化模板。 |
|
||||
| `symbol` | `"🐏"` | 这个字段的内容会显示在当前内存使用情况之前。 |
|
||||
| `style` | `"bold dimmed white"` | 此组件的样式。 |
|
||||
| `disabled` | `true` | 禁用 `memory_usage` 模块 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ----------- | ----------------------------------------------- | -------------------------------------------------------- |
|
||||
| `threshold` | `75` | Hide the memory usage unless it exceeds this percentage. |
|
||||
| `format` | `"via $symbol [${ram}( \| ${swap})]($style) "` | 组件格式化模板。 |
|
||||
| `symbol` | `"🐏"` | The symbol used before displaying the memory usage. |
|
||||
| `style` | `"bold dimmed white"` | 此组件的样式。 |
|
||||
| `disabled` | `true` | Disables the `memory_usage` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1871,18 +1891,18 @@ style = "bold dimmed green"
|
||||
|
||||
## Mercurial Branch
|
||||
|
||||
`hg_branch` 组件显示当前目录的 hg 仓库的活动分支。
|
||||
The `hg_branch` module shows the active branch of the repo in your current directory.
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------- | --------------------------------------------- |
|
||||
| `symbol` | `" "` | 该字段的内容显示于当前仓库的 hg 书签或活动分支名之前。 |
|
||||
| `style` | `"bold purple"` | 此组件的样式。 |
|
||||
| `format` | `"on [$symbol$branch]($style) "` | 组件格式化模板。 |
|
||||
| `truncation_length` | `2^63 - 1` | Truncates the hg branch name to `N` graphemes |
|
||||
| `truncation_symbol` | `"…"` | 此字段的内容用来表示分支名称被截断。 |
|
||||
| `disabled` | `true` | 禁用 `hg_branch` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `symbol` | `" "` | The symbol used before the hg bookmark or branch name of the repo in your current directory. |
|
||||
| `style` | `"bold purple"` | 此组件的样式。 |
|
||||
| `format` | `"on [$symbol$branch]($style) "` | 组件格式化模板。 |
|
||||
| `truncation_length` | `2^63 - 1` | Truncates the hg branch name to `N` graphemes |
|
||||
| `truncation_symbol` | `"…"` | The symbol used to indicate a branch name was truncated. |
|
||||
| `disabled` | `true` | Disables the `hg_branch` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1909,7 +1929,7 @@ truncation_symbol = ""
|
||||
|
||||
The `nim` module shows the currently installed version of [Nim](https://nim-lang.org/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `nim.cfg` 文件
|
||||
- The current directory contains a `nim.cfg` file
|
||||
- The current directory contains a file with the `.nim` extension
|
||||
- The current directory contains a file with the `.nims` extension
|
||||
- The current directory contains a file with the `.nimble` extension
|
||||
@@ -1949,7 +1969,7 @@ symbol = "🎣 "
|
||||
|
||||
## Nix-shell
|
||||
|
||||
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. 当处于一个 nix-shell 环境中时,此组件会被显示。
|
||||
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. The module will be shown when inside a nix-shell environment.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1960,7 +1980,7 @@ The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/
|
||||
| `style` | `"bold blue"` | 此组件的样式。 |
|
||||
| `impure_msg` | `"impure"` | A format string shown when the shell is impure. |
|
||||
| `pure_msg` | `"pure"` | A format string shown when the shell is pure. |
|
||||
| `disabled` | `false` | 禁用 `nix_shell` 组件。 |
|
||||
| `disabled` | `false` | Disables the `nix_shell` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1989,10 +2009,10 @@ format = 'via [☃️ $state( \($name\))](bold blue) '
|
||||
|
||||
The `nodejs` module shows the currently installed version of [Node.js](https://nodejs.org/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含 `package.json` 文件
|
||||
- The current directory contains a `package.json` file
|
||||
- The current directory contains a `.node-version` file
|
||||
- The current directory contains a `.nvmrc` file
|
||||
- 当前目录包含 `node_modules` 目录
|
||||
- The current directory contains a `node_modules` directory
|
||||
- The current directory contains a file with the `.js`, `.mjs` or `.cjs` extension
|
||||
- The current directory contains a file with the `.ts` extension
|
||||
|
||||
@@ -2007,7 +2027,7 @@ The `nodejs` module shows the currently installed version of [Node.js](https://n
|
||||
| `detect_files` | `["package.json", ".node-version"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `["node_modules"]` | Which folders should trigger this module. |
|
||||
| `style` | `"bold green"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `nodejs` 组件。 |
|
||||
| `disabled` | `false` | Disables the `nodejs` module. |
|
||||
| `not_capable_style` | `bold red` | The style for the module when an engines property in package.json does not match the Node.js version. |
|
||||
|
||||
### Variables
|
||||
@@ -2113,7 +2133,7 @@ symbol = "☁️ "
|
||||
|
||||
## Package Version
|
||||
|
||||
当前目录是软件包的代码仓库时,将显示 `package` 组件,并显示软件包当前版本。 The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
|
||||
The `package` module is shown when the current directory is the repository for a package, and shows its current version. The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `composer`, `gradle`, `julia`, `mix`, `helm` and `shards` packages.
|
||||
|
||||
- [**npm**](https://docs.npmjs.com/cli/commands/npm) – The `npm` package version is extracted from the `package.json` present in the current directory
|
||||
- [**Cargo**](https://doc.rust-lang.org/cargo/) – The `cargo` package version is extracted from the `Cargo.toml` present in the current directory
|
||||
@@ -2129,6 +2149,7 @@ symbol = "☁️ "
|
||||
- [**Meson**](https://mesonbuild.com/) - The `meson` package version is extracted from the `meson.build` present
|
||||
- [**Shards**](https://crystal-lang.org/reference/the_shards_command/index.html) - The `shards` package version is extracted from the `shard.yml` present
|
||||
- [**V**](https://vlang.io) - The `vlang` package version is extracted from the `v.mod` present
|
||||
- [**SBT**](https://scala-sbt.org) - The `sbt` package version is extracted from the `build.sbt` present in the current directory
|
||||
|
||||
> ⚠ 此组件显示的是源代码在当前目录中的软件包的版本,而不是包管理器的版本。
|
||||
|
||||
@@ -2137,11 +2158,11 @@ symbol = "☁️ "
|
||||
| Option | 默认值 | 描述 |
|
||||
| ----------------- | --------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `format` | `"is [$symbol$version]($style) "` | 组件格式化模板。 |
|
||||
| `symbol` | `"📦 "` | 这个字段的内容会显示在当前软件包版本之前。 |
|
||||
| `symbol` | `"📦 "` | The symbol used before displaying the version the package. |
|
||||
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||
| `style` | `"bold 208"` | 此组件的样式。 |
|
||||
| `display_private` | `false` | Enable displaying version for packages marked as private. |
|
||||
| `disabled` | `false` | 禁用 `package` 组件。 |
|
||||
| `disabled` | `false` | Disables the `package` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -2206,7 +2227,7 @@ format = "via [🦪 $version]($style) "
|
||||
|
||||
The `php` module shows the currently installed version of [PHP](https://www.php.net/). By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- 当前目录包含一个 `composer.json` 文件
|
||||
- The current directory contains a `composer.json` file
|
||||
- The current directory contains a `.php-version` file
|
||||
- The current directory contains a `.php` extension
|
||||
|
||||
@@ -2216,12 +2237,12 @@ The `php` module shows the currently installed version of [PHP](https://www.php.
|
||||
| ------------------- | ------------------------------------ | ------------------------------------------------------------------------- |
|
||||
| `format` | `"via [$symbol($version )]($style)"` | 组件格式化模板。 |
|
||||
| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||
| `symbol` | `"🐘 "` | 这个字段的内容会显示在当前 PHP 版本之前。 |
|
||||
| `symbol` | `"🐘 "` | The symbol used before displaying the version of PHP. |
|
||||
| `detect_extensions` | `["php"]` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `["composer.json", ".php-version"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this module. |
|
||||
| `style` | `"147 bold"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `php` 组件。 |
|
||||
| `disabled` | `false` | Disables the `php` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -2636,7 +2657,7 @@ The `shell` module shows an indicator for currently used shell.
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -2753,7 +2774,7 @@ The `status` module displays the exit code of the previous command. The module w
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -2809,6 +2830,56 @@ disabled = false
|
||||
|
||||
```
|
||||
|
||||
## Sudo
|
||||
|
||||
The `sudo` module displays if sudo credentials are currently cached. The module will only be shown if credentials are cached.
|
||||
|
||||
::: tip
|
||||
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| --------------- | ----------------------- | ------------------------------------------------------- |
|
||||
| `format` | `[as $symbol]($style)"` | The format of the module |
|
||||
| `symbol` | `"🧙 "` | The symbol displayed when credentials are cached |
|
||||
| `style` | `"bold blue"` | 此组件的样式。 |
|
||||
| `allow_windows` | `false` | Since windows has no default sudo, default is disabled. |
|
||||
| `disabled` | `true` | Disables the `sudo` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
| 字段 | 示例 | 描述 |
|
||||
| --------- | -- | ----------- |
|
||||
| symbol | | `symbol`对应值 |
|
||||
| style\* | | `style`对应值 |
|
||||
|
||||
\*: This variable can only be used as a part of a style string
|
||||
|
||||
### 示例
|
||||
|
||||
```toml
|
||||
|
||||
# ~/.config/starship.toml
|
||||
|
||||
[sudo]
|
||||
style = "bold green"
|
||||
symbol = "👩💻 "
|
||||
disabled = false
|
||||
```
|
||||
|
||||
```toml
|
||||
# On windows
|
||||
# $HOME\.starship\config.toml
|
||||
|
||||
[sudo]
|
||||
allow_windows = true
|
||||
disabled = false
|
||||
```
|
||||
|
||||
## Swift
|
||||
|
||||
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). The module will be shown if any of the following conditions are met:
|
||||
@@ -2913,7 +2984,7 @@ The `time` module shows the current **local** time. The `format` configuration v
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ starship bug-report
|
||||
|
||||
## Why don't I see a glyph symbol in my prompt?
|
||||
|
||||
The most common cause of this is system misconfiguration. Some Linux distros in particular do not come with font support out-of-the-box. You need to ensure that:
|
||||
最常见的原因是系统配置有问题。 有个别Linux发行版不自带对字体的支持。 请确保:
|
||||
|
||||
- Your locale is set to a UTF-8 value, like `de_DE.UTF-8` or `ja_JP.UTF-8`. If `LC_ALL` is not a UTF-8 value, [you will need to change it](https://www.tecmint.com/set-system-locales-in-linux/).
|
||||
- 安装了 emoji 字体。 大部分系统都会自带 emoji 字体,但有些系统(例如 Arch Linux)则没有。 字体一般可以用系统的包管理器安装,常见的字体有 [Noto emoji](https://www.google.com/get/noto/help/emoji/) 等。
|
||||
@@ -101,20 +101,20 @@ echo -e "\xf0\x9f\x90\x8d"
|
||||
echo -e "\xee\x82\xa0"
|
||||
```
|
||||
|
||||
The first line should produce a [snake emoji](https://emojipedia.org/snake/), while the second should produce a [powerline branch symbol (e0a0)](https://github.com/ryanoasis/powerline-extra-symbols#glyphs).
|
||||
第一行应该显示出一个[蛇的 emoji](https://emojipedia.org/snake/),第二行应该显示出 [powerline 的分支符号(e0a0)。](https://github.com/ryanoasis/powerline-extra-symbols#glyphs).
|
||||
|
||||
If either symbol fails to display correctly, your system is still misconfigured. Unfortunately, getting font configuration correct is sometimes difficult. Users on the Discord may be able to help. If both symbols display correctly, but you still don't see them in starship, [file a bug report!](https://github.com/starship/starship/issues/new/choose)
|
||||
|
||||
## How do I uninstall Starship?
|
||||
## 如何卸载 Starship?
|
||||
|
||||
Starship is just as easy to uninstall as it is to install in the first place.
|
||||
Starship 的卸载过程与安装过程一样简单。
|
||||
|
||||
1. 将 shell 的配置文件(比如 `~/.bashrc`)中初始化 Starship 的部分全部删除。
|
||||
1. 删除 Starship 的二进制文件。
|
||||
|
||||
If Starship was installed using a package manager, please refer to their docs for uninstallation instructions.
|
||||
如果 Starship 是用包管理器安装的,请到包管理器的文档中查找卸载的步骤。
|
||||
|
||||
If Starship was installed using the install script, the following command will delete the binary:
|
||||
如果 Starship 是用安装脚本安装的,可以用以下命令删除二进制文件:
|
||||
|
||||
```sh
|
||||
# Locate and delete the starship binary
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
|
||||
## 🤝 贡献
|
||||
|
||||
我们一直在寻找贡献者!你都可以参与贡献 ** 不论你的技能如何 **。 如果您希望快速为项目作出贡献,请尝试解决 [good first issue](https://github.com/starship/starship/labels/🌱%20good%20first%20issue)。
|
||||
我们一直在寻找贡献者!**不论你的技能如何**你都可以参与贡献 。 如果您希望快速为项目作出贡献,请尝试解决 [good first issue](https://github.com/starship/starship/labels/🌱%20good%20first%20issue)。
|
||||
|
||||
If you are fluent in a non-English language, we greatly appreciate any help keeping our docs translated and up-to-date in other languages. If you would like to help, translations can be contributed on the [Starship Crowdin](https://translate.starship.rs/).
|
||||
|
||||
@@ -306,7 +306,7 @@ If you are fluent in a non-English language, we greatly appreciate any help keep
|
||||
|
||||
## 💭该项目受以下项目启发
|
||||
|
||||
Please check out these previous works that helped inspire the creation of starship. 🙏
|
||||
请参考这些曾经为 Starship 提供启发的工程。 🙏
|
||||
|
||||
- **[denysdovhan/spaceship-prompt](https://github.com/denysdovhan/spaceship-prompt)** - A ZSH prompt for astronauts.
|
||||
|
||||
|
||||
@@ -223,6 +223,9 @@ format = '\[[$symbol($version)]($style)\]'
|
||||
[scala]
|
||||
format = '\[[$symbol($version)]($style)\]'
|
||||
|
||||
[sudo]
|
||||
format = '\[[as $symbol]\]
|
||||
|
||||
[swift]
|
||||
format = '\[[$symbol($version)]($style)\]'
|
||||
|
||||
@@ -371,6 +374,9 @@ symbol = "rs "
|
||||
[scala]
|
||||
symbol = "scala "
|
||||
|
||||
[sudo]
|
||||
symbol = "sudo "
|
||||
|
||||
[swift]
|
||||
symbol = "swift "
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user