mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
docs(i18n): new Crowdin updates (#3344)
* New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (French) * New translations README.md (French) * New translations README.md (French) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (French) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (French) * New translations README.md (Korean) * New translations README.md (German) * New translations README.md (Italian) * New translations README.md (Italian) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Korean) * New translations README.md (Dutch) * New translations README.md (Dutch) * New translations README.md (Polish) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Portuguese) * New translations README.md (Russian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (Chinese Simplified) * New translations README.md (Arabic) * New translations README.md (German) * New translations README.md (Italian) * New translations README.md (Japanese) * New translations README.md (Korean) * New translations README.md (Dutch) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Russian) * New translations README.md (Turkish) * New translations README.md (Chinese Traditional) * New translations README.md (Arabic) * New translations README.md (Vietnamese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Indonesian) * New translations README.md (Sorani (Kurdish)) * New translations README.md (French) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Russian) * New translations README.md (French) * New translations README.md (Dutch) * New translations README.md (Spanish) * New translations README.md (Arabic) * New translations README.md (German) * New translations README.md (Italian) * New translations README.md (Japanese) * New translations README.md (Korean) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Russian) * New translations README.md (Turkish) * New translations README.md (Chinese Traditional) * New translations README.md (Vietnamese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Indonesian) * New translations README.md (Chinese Simplified) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Turkish) * New translations README.md (Turkish) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Traditional) * New translations README.md (Vietnamese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Vietnamese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Indonesian) * New translations README.md (Indonesian) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Russian) * New translations README.md (Russian) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (French) * New translations README.md (Russian) * New translations README.md (Indonesian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Portuguese) * New translations README.md (Spanish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish))
This commit is contained in:
+116
-98
@@ -9,11 +9,11 @@ mkdir -p ~/.config && touch ~/.config/starship.toml
|
||||
Starship 的所有配置都在此 [TOML](https://github.com/toml-lang/toml) 配置文件中完成:
|
||||
|
||||
```toml
|
||||
# Inserts a blank line between shell prompts
|
||||
# 在shell提示符插入新行
|
||||
add_newline = true
|
||||
|
||||
# Replace the "❯" symbol in the prompt with "➜"
|
||||
[character] # The name of the module we are configuring is "character"
|
||||
# 在提示处使用"➜"替换"❯"
|
||||
[character] # 配置的模块名:character
|
||||
success_symbol = "[➜](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green"
|
||||
|
||||
# Disable the package module, hiding it from the prompt completely
|
||||
@@ -24,18 +24,24 @@ disabled = true
|
||||
您可以使用 `STARSHIP_CONFIG` 环境变量更改默认配置文件的位置:
|
||||
|
||||
```sh
|
||||
export STARSHIP_CONFIG=~/.starship/config.toml
|
||||
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
|
||||
```
|
||||
|
||||
在 PowerShell (Windows) 中,在 `$PROFILE` 中添加下面的代码行能达到同样的效果:
|
||||
|
||||
```powershell
|
||||
$ENV:STARSHIP_CONFIG = "$HOME\.starship\config.toml"
|
||||
$ENV:STARSHIP_CONFIG = "$HOME\example\non\default\path\starship.toml"
|
||||
```
|
||||
|
||||
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
|
||||
|
||||
```lua
|
||||
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\user\\example\\non\\default\\path\\starship.toml')
|
||||
```
|
||||
|
||||
### 日志
|
||||
|
||||
默认情况下,Starship 会将警告和错误日志记录到文件 `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`. 其中 session key 与您的终端实例相对应。 不过,这也可以使用 `STARSHIP_CACHE` 环境变量来修改:
|
||||
By default starship logs warnings and errors into a file named `~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log`, where the session key is corresponding to a instance of your terminal. This, however can be changed using the `STARSHIP_CACHE` environment variable:
|
||||
|
||||
```sh
|
||||
export STARSHIP_CACHE=~/.starship/cache
|
||||
@@ -47,9 +53,15 @@ export STARSHIP_CACHE=~/.starship/cache
|
||||
$ENV:STARSHIP_CACHE = "$HOME\AppData\Local\Temp"
|
||||
```
|
||||
|
||||
Or for Cmd (Windows) would be adding this line to your `starship.lua`:
|
||||
|
||||
```lua
|
||||
os.setenv('STARSHIP_CACHE', 'C:\\Users\\user\\AppData\\Local\\Temp')
|
||||
```
|
||||
|
||||
### 术语
|
||||
|
||||
**组件(Module)**:提示符的组成部分,通过来自系统的上下文信息向用户显示各种信息。 例如,如果您当前的目录是 Node.js 项目,“nodejs” 模块会显示当前安装在您电脑上的 Node.js 的版本。
|
||||
**Module**: A component in the prompt giving information based on contextual information from your OS. For example, the "nodejs" module shows the version of Node.js that is currently installed on your computer, if your current directory is a Node.js project.
|
||||
|
||||
**Variable**: Smaller sub-components that contain information provided by the module. For example, the "version" variable in the "nodejs" module contains the current version of Node.js.
|
||||
|
||||
@@ -85,7 +97,7 @@ For example:
|
||||
|
||||
#### 样式设定
|
||||
|
||||
Starship 中的大多数组件允许您为其设置显示样式。 显示样式可以通过一个字符串字段(一般是 `style`)来设置。 以下的例子给出了一些样式字符串并描述了它们的效果。 样式字符串的完整语法请查阅 [高级配置指南](/advanced-config/)。
|
||||
Most modules in starship allow you to configure their display styles. This is done with an entry (usually called `style`) which is a string specifying the configuration. Here are some examples of style strings along with what they do. For details on the full syntax, consult the [advanced config guide](/advanced-config/).
|
||||
|
||||
- `"fg:green bg:blue"` 在蓝色背景上显示绿色文本
|
||||
- `"bg:blue fg:bright-green"` 在蓝色背景上显示亮绿色文本
|
||||
@@ -94,7 +106,7 @@ Starship 中的大多数组件允许您为其设置显示样式。 显示样式
|
||||
- `"bold italic fg:purple"` 设置文本为粗体、意大利体,颜色为紫色
|
||||
- `""` 显式禁用所有样式
|
||||
|
||||
请注意,最终的显示样式将由您的终端模拟器控制。 例如,有的终端模拟器对于“bold”属性的文本是加亮颜色而不是加粗文字,有的颜色主题对“普通”和“明亮”两种属性的颜色使用相同的颜色值。 此外,要获得意大利体文本(一般设计为斜体),您的终端必须支持意大利体显示。
|
||||
Note that what styling looks like will be controlled by your terminal emulator. For example, some terminal emulators will brighten the colors instead of bolding text, and some color themes use the same values for the normal and bright colors. Also, to get italic text, your terminal must support italics.
|
||||
|
||||
#### Conditional Format Strings
|
||||
|
||||
@@ -131,7 +143,7 @@ format = '''
|
||||
|
||||
## 提示符
|
||||
|
||||
以下是关于提示符的配置项。
|
||||
This is the list of prompt-wide configuration options.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -164,7 +176,7 @@ add_newline = false
|
||||
|
||||
### 默认提示符格式
|
||||
|
||||
The default `format` is used to define the format of the prompt, if empty or no `format` is provided. 默认设置如下:
|
||||
The default `format` is used to define the format of the prompt, if empty or no `format` is provided. The default is as shown:
|
||||
|
||||
```toml
|
||||
format = "$all"
|
||||
@@ -248,7 +260,7 @@ format="$all$directory$character"
|
||||
|
||||
## AWS
|
||||
|
||||
`aws` 组件显示当前 AWS 主机所在区域与配置信息。 各组件基于 `AWS_REGION`,`AWS_DEFAULT_REGION` 和 `AWS_PROFILE` 环境变量与 `~/.aws/config` 文件。 This module also shows an expiration timer when using temporary credentials.
|
||||
The `aws` module shows the current AWS region and profile. This is based on `AWS_REGION`, `AWS_DEFAULT_REGION`, and `AWS_PROFILE` env var with `~/.aws/config` file. This module also shows an expiration timer when using temporary credentials.
|
||||
|
||||
When using [aws-vault](https://github.com/99designs/aws-vault) the profile is read from the `AWS_VAULT` env var and the credentials expiration date is read from the `AWS_SESSION_EXPIRATION` env var.
|
||||
|
||||
@@ -347,7 +359,7 @@ style = "blue bold"
|
||||
|
||||
## Battery
|
||||
|
||||
`battery` 组件显示电池充电情况和当前充电状态。 这个组件只会在当前电量低于 10% 时显示。
|
||||
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%.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -375,7 +387,7 @@ discharging_symbol = "💀 "
|
||||
|
||||
### Battery 组件的显示
|
||||
|
||||
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. The default is as shown:
|
||||
|
||||
```toml
|
||||
[[battery.display]]
|
||||
@@ -387,7 +399,7 @@ 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 | 默认值 | 描述 |
|
||||
| -------------------- | ---------- | --------------------------------------------------------------------------------------------------------- |
|
||||
@@ -414,9 +426,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 (`❯`/`✖`)
|
||||
@@ -425,13 +437,13 @@ By default it only changes color. If you also want to change its shape take a lo
|
||||
|
||||
::: warning
|
||||
|
||||
`error_symbol` is not supported on elvish and nu shell.
|
||||
`error_symbol` is not supported on nu shell.
|
||||
|
||||
:::
|
||||
|
||||
::: warning
|
||||
|
||||
`vicmd_symbol` is only supported in fish and zsh.
|
||||
`vicmd_symbol` is only supported in cmd, fish and zsh.
|
||||
|
||||
:::
|
||||
|
||||
@@ -544,15 +556,15 @@ 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.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -568,7 +580,7 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
|
||||
|
||||
::: tip
|
||||
|
||||
Showing desktop notifications requires starship to be built with `rust-notify` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
|
||||
Showing desktop notifications requires starship to be built with `notify-rust` support. You check if your starship supports notifications by running `STARSHIP_LOG=debug starship module cmd_duration -d 60000` when `show_notifications` is set to `true`.
|
||||
|
||||
:::
|
||||
|
||||
@@ -597,7 +609,7 @@ 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`.
|
||||
|
||||
:::
|
||||
|
||||
@@ -713,20 +725,20 @@ format = "via [🔰 $version](bold red) "
|
||||
## Deno
|
||||
|
||||
The `deno` module shows you your currently installed version of [Deno](https://deno.land/). By default the module will be shown if any of the following conditions are met:
|
||||
- The current directory contains a `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
|
||||
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
|
||||
|
||||
### 配置项
|
||||
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `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 Deno |
|
||||
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this module. |
|
||||
| `style` | `"green bold"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | Disables the `deno` module. |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `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 Deno |
|
||||
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `["deno.json", "deno.jsonc", "mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this module. |
|
||||
| `style` | `"green bold"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | Disables the `deno` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -747,29 +759,30 @@ 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 仓库根目录下。 |
|
||||
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | 组件格式化模板。 |
|
||||
| `style` | `"bold cyan"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `directory` 组件。 |
|
||||
| `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 when `truncate_to_repo` option is set to false. |
|
||||
| `home_symbol` | `"~"` | The symbol indicating home directory. |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `truncation_length` | `3` | 当前目录路径被截断后最多保留的父目录数量。 |
|
||||
| `truncate_to_repo` | `true` | 是否只截断到您当前处于的 git 仓库根目录下。 |
|
||||
| `format` | `"[$path]($style)[$read_only]($read_only_style) "` | 组件格式化模板。 |
|
||||
| `style` | `"bold cyan"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `directory` 组件。 |
|
||||
| `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 when `truncate_to_repo` option is set to false. |
|
||||
| `home_symbol` | `"~"` | The symbol indicating home directory. |
|
||||
| `use_os_path_sep` | `true` | Use the OS specific path seperator instead of always using `/` (e.g. `\` on Windows) |
|
||||
|
||||
<details>
|
||||
<summary>此组件有几个高级配置选项来控制当前目录路径的显示方式。</summary>
|
||||
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
|
||||
|
||||
| Advanced Option | 默认值 | 描述 |
|
||||
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
@@ -846,7 +859,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:
|
||||
|
||||
@@ -861,7 +874,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.
|
||||
|
||||
@@ -984,7 +997,7 @@ 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`
|
||||
@@ -1174,7 +1187,7 @@ asia-northeast1 = "an1"
|
||||
|
||||
## Git Branch
|
||||
|
||||
`git_branch` 组件显示当前目录的 git 仓库的活动分支。
|
||||
The `git_branch` module shows the active branch of the repo in your current directory.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1249,7 +1262,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.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1293,7 +1306,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.
|
||||
|
||||
:::
|
||||
|
||||
@@ -1330,26 +1343,27 @@ 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` | `"="` | 这个分支有合并冲突。 |
|
||||
| `ahead` | `"⇡"` | The format of `ahead` |
|
||||
| `behind` | `"⇣"` | The format of `behind` |
|
||||
| `diverged` | `"⇕"` | The format of `diverged` |
|
||||
| `up_to_date` | `""` | The format of `up_to_date` |
|
||||
| `untracked` | `"?"` | The format of `untracked` |
|
||||
| `stashed` | `"$"` | The format of `stashed` |
|
||||
| `modified` | `"!"` | The format of `modified` |
|
||||
| `staged` | `"+"` | The format of `staged` |
|
||||
| `renamed` | `"»"` | The format of `renamed` |
|
||||
| `deleted` | `"✘"` | The format of `deleted` |
|
||||
| `style` | `"bold red"` | 此组件的样式。 |
|
||||
| `disabled` | `false` | 禁用 `git_status` 组件。 |
|
||||
| Option | 默认值 | 描述 |
|
||||
| ------------------- | ----------------------------------------------- | ----------------------------------- |
|
||||
| `format` | `'([\[$all_status$ahead_behind\]]($style) )'` | The default format for `git_status` |
|
||||
| `conflicted` | `"="` | 这个分支有合并冲突。 |
|
||||
| `ahead` | `"⇡"` | The format of `ahead` |
|
||||
| `behind` | `"⇣"` | The format of `behind` |
|
||||
| `diverged` | `"⇕"` | The format of `diverged` |
|
||||
| `up_to_date` | `""` | The format of `up_to_date` |
|
||||
| `untracked` | `"?"` | The format of `untracked` |
|
||||
| `stashed` | `"$"` | The format of `stashed` |
|
||||
| `modified` | `"!"` | The format of `modified` |
|
||||
| `staged` | `"+"` | The format of `staged` |
|
||||
| `renamed` | `"»"` | The format of `renamed` |
|
||||
| `deleted` | `"✘"` | The format of `deleted` |
|
||||
| `style` | `"bold red"` | 此组件的样式。 |
|
||||
| `ignore_submodules` | `false` | Ignore changes to submodules. |
|
||||
| `disabled` | `false` | Disables the `git_status` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -1499,7 +1513,7 @@ format = "via [⎈ $version](bold white) "
|
||||
|
||||
## Hostname
|
||||
|
||||
`hostname` 组件显示系统主机名。
|
||||
The `hostname` module shows the system hostname.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1513,10 +1527,10 @@ format = "via [⎈ $version](bold white) "
|
||||
|
||||
### Variables
|
||||
|
||||
| 字段 | 示例 | 描述 |
|
||||
| --------- | -- | ----------- |
|
||||
| symbol | | `symbol`对应值 |
|
||||
| style\* | | `style`对应值 |
|
||||
| 字段 | 示例 | 描述 |
|
||||
| --------- | ---------- | ---------------------------- |
|
||||
| hostname | `computer` | The hostname of the computer |
|
||||
| style\* | | `style`对应值 |
|
||||
|
||||
\*: This variable can only be used as a part of a style string
|
||||
|
||||
@@ -1573,7 +1587,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:
|
||||
|
||||
@@ -1722,7 +1736,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.
|
||||
|
||||
:::
|
||||
|
||||
@@ -1784,7 +1798,7 @@ 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.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1844,13 +1858,13 @@ 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.
|
||||
|
||||
:::
|
||||
|
||||
@@ -1891,7 +1905,7 @@ style = "bold dimmed green"
|
||||
|
||||
## Mercurial Branch
|
||||
|
||||
`hg_branch` 组件显示当前目录的 hg 仓库的活动分支。
|
||||
The `hg_branch` module shows the active branch of the repo in your current directory.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -1969,7 +1983,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.
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -2133,7 +2147,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`, `shards` and `dart` 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
|
||||
@@ -2150,6 +2164,7 @@ symbol = "☁️ "
|
||||
- [**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
|
||||
- [**Dart**](https://pub.dev/) - The `dart` package version is extracted from the `pubspec.yaml` present in the current directory
|
||||
|
||||
> ⚠ 此组件显示的是源代码在当前目录中的软件包的版本,而不是包管理器的版本。
|
||||
|
||||
@@ -2363,7 +2378,7 @@ format = "via [$symbol$version](bold white)"
|
||||
|
||||
The `python` module shows the currently installed version of [Python](https://www.python.org/) and the current [Python virtual environment](https://docs.python.org/tutorial/venv.html) if one is activated.
|
||||
|
||||
如果`pyenv_version_name`被设置为`true`, 本组件将会展示pyenv版本名。 否则则显示通过`python --version`获得的版本号
|
||||
If `pyenv_version_name` is set to `true`, it will display the pyenv version name. Otherwise, it will display the version number from `python --version`.
|
||||
|
||||
By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
@@ -2657,7 +2672,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.
|
||||
|
||||
:::
|
||||
|
||||
@@ -2673,6 +2688,8 @@ The `shell` module shows an indicator for currently used shell.
|
||||
| `elvish_indicator` | `esh` | A format string used to represent elvish. |
|
||||
| `tcsh_indicator` | `tsh` | A format string used to represent tcsh. |
|
||||
| `xonsh_indicator` | `xsh` | A format string used to represent xonsh. |
|
||||
| `cmd_indicator` | `cmd` | A format string used to represent cmd. |
|
||||
| `nu_indicator` | `nu` | A format string used to represent nu. |
|
||||
| `unknown_indicator` | | The default value to be displayed when the shell is unknown. |
|
||||
| `format` | `"[$indicator]($style) "` | 组件格式化模板。 |
|
||||
| `style` | `"white bold"` | 此组件的样式。 |
|
||||
@@ -2774,11 +2791,11 @@ 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.
|
||||
|
||||
:::
|
||||
|
||||
::: warning This module is not supported on elvish and nu shell. :::
|
||||
::: warning This module is not supported on nu shell. :::
|
||||
|
||||
### 配置项
|
||||
|
||||
@@ -2804,6 +2821,7 @@ The `status` module displays the exit code of the previous command. The module w
|
||||
| 字段 | 示例 | 描述 |
|
||||
| -------------- | ------- | ------------------------------------------------------------------------------------------- |
|
||||
| status | `127` | The exit code of the last command |
|
||||
| hex_status | `0x7F` | The exit code of the last command in hex |
|
||||
| int | `127` | The exit code of the last command |
|
||||
| common_meaning | `ERROR` | Meaning of the code if not a signal |
|
||||
| signal_number | `9` | Signal number corresponding to the exit code, only if signalled |
|
||||
@@ -2836,7 +2854,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -2980,11 +2998,11 @@ format = "[🏎💨 $workspace]($style) "
|
||||
|
||||
## Time
|
||||
|
||||
`time` 组件显示当前的 **本地** 时间。 `format` 字段值会提供给 [`chrono`](https://crates.io/crates/chrono) crate 用来控制时间显示方式。 请参阅 [chrono strftime 文档](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) 以了解可用格式选项。
|
||||
The `time` module shows the current **local** time. The `format` configuration value is used by the [`chrono`](https://crates.io/crates/chrono) crate to control how the time is displayed. Take a look [at the chrono strftime docs](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) to see what options are available.
|
||||
|
||||
::: tip
|
||||
|
||||
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`。
|
||||
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
:::
|
||||
|
||||
@@ -3000,7 +3018,7 @@ format = "[🏎💨 $workspace]($style) "
|
||||
| `disabled` | `true` | 禁用 `time` 组件。 |
|
||||
| `time_range` | `"-"` | Sets the time range during which the module will be shown. Times must be specified in 24-hours format |
|
||||
|
||||
If `use_12hr` is `true`, then `time_format` defaults to `"%r"`. 否则,其默认值为 `"%T"`。 Manually setting `time_format` will override the `use_12hr` setting.
|
||||
If `use_12hr` is `true`, then `time_format` defaults to `"%r"`. Otherwise, it defaults to `"%T"`. Manually setting `time_format` will override the `use_12hr` setting.
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -3026,7 +3044,7 @@ time_range = "10:00:00-14:00:00"
|
||||
|
||||
## Username
|
||||
|
||||
`username` 组件显示当前活跃的用户名。 此组件只有满足以下条件之一时才会被显示:
|
||||
The `username` module shows active user's username. 此组件只有满足以下条件之一时才会被显示:
|
||||
|
||||
- 当前用户是 root
|
||||
- 当前用户与登录用户不相同
|
||||
|
||||
Reference in New Issue
Block a user