diff options
author | Matan Kushner <hello@matchai.dev> | 2022-01-15 17:08:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-15 23:08:31 +0100 |
commit | 6aa2bab97ee957322f15effdf5fb721a046060f4 (patch) | |
tree | d3b6867f794790135c0204ac79a60b6b1afe8168 /docs/zh-TW | |
parent | 682f49abdb7065f0053ca7ec82de166027a72072 (diff) |
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))
Diffstat (limited to 'docs/zh-TW')
-rw-r--r-- | docs/zh-TW/README.md | 15 | ||||
-rw-r--r-- | docs/zh-TW/advanced-config/README.md | 102 | ||||
-rw-r--r-- | docs/zh-TW/config/README.md | 202 | ||||
-rw-r--r-- | docs/zh-TW/faq/README.md | 8 | ||||
-rw-r--r-- | docs/zh-TW/guide/README.md | 31 | ||||
-rw-r--r-- | docs/zh-TW/presets/README.md | 2 |
6 files changed, 236 insertions, 124 deletions
diff --git a/docs/zh-TW/README.md b/docs/zh-TW/README.md index 84b2d0ce4..8999fba0d 100644 --- a/docs/zh-TW/README.md +++ b/docs/zh-TW/README.md @@ -18,7 +18,7 @@ features: footer: ISC Licensed | Copyright © 2019-present Starship Contributors #Used for the description meta tag, for SEO metaTitle: "Starship:跨 Shell 提示字元" -description: Starship 是適合任何 shell 的最小、極速、高度客製化的提示字元! 顯示你需要的訊息,同時保持順暢與最小化。 針對 Bash、Fish、ZSH、Ion、Tcsh、Elvish、Nu、Xonsh 以及 Powershell 有快速安裝可供使用。 +description: Starship 是適合任何 shell 的最小、極速、高度客製化的提示字元! 顯示你需要的訊息,同時保持順暢與最小化。 Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell. --- <div class="center"> @@ -119,7 +119,7 @@ description: Starship 是適合任何 shell 的最小、極速、高度客製化 #### Elvish - ::: warning 只有 elvish v0.15 或以上版本才有支援 ::: + ::: warning Only elvish v0.17 or higher is supported. ::: 將以下內容放到 `~/.elvish/rc.elv` 的結尾: @@ -164,3 +164,14 @@ description: Starship 是適合任何 shell 的最小、極速、高度客製化 execx($(starship init xonsh)) ``` + + + #### Cmd + + You need to use [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) with Cmd. Add the following to a file `starship.lua` and place this file in Clink scripts directory: + + ```lua + -- starship.lua + + load(io.popen('starship init cmd'):read("*a"))() + ``` diff --git a/docs/zh-TW/advanced-config/README.md b/docs/zh-TW/advanced-config/README.md index c09abf788..c1e93f477 100644 --- a/docs/zh-TW/advanced-config/README.md +++ b/docs/zh-TW/advanced-config/README.md @@ -8,11 +8,35 @@ ::: -## Bash 中的自定義預提示 (pre-prompt) 與預執行 (pre-execution) 指令 +## Custom pre-prompt and pre-execution Commands in Cmd -Bash 不像其他大多的 shell 具有正式的預執行/預指令框架。 因為這個原因,很難在 `bash` 中提供能完全自定義的 hook。 然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: +Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements: -- 為了在畫出提示字元之前執行一個自定義的函式,請定義一個函式,並將它的名稱放入 `starship_precmd_user_func` 之中。 例如,為了要在提示字元前畫出一個火箭,你就要 +- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do + +```lua +function starship_preprompt_user_func(prompt) + print("🚀") +end + +load(io.popen('starship init cmd'):read("*a"))() +``` + +- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do + +```lua +function starship_precmd_user_func(line) + print("Executing: "..line) +end + +load(io.popen('starship init cmd'):read("*a"))() +``` + +## Custom pre-prompt and pre-execution Commands in Bash + +Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. 然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: + +- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do ```bash function blastoff(){ @@ -21,13 +45,13 @@ function blastoff(){ starship_precmd_user_func="blastoff" ``` -- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). 然而,你**必須**在初始化 Starship *之前* 對 DEBUG 訊號設下trap! Starship 可以保留 DEBUG trap 的數值,但是如果該 trap 在 starship 啟動後被被覆寫,某些功能會損壞。 +- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break. ```bash function blastoff(){ echo "🚀" } -trap blastoff DEBUG # 在 Starship 啟用*前*對 DEBUG 訊號設下 trap +trap blastoff DEBUG # Trap DEBUG *before* running starship eval $(starship init bash) ``` @@ -43,33 +67,33 @@ 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 甚至預設就會這樣做。 Starship 沒有幫你這樣做,但是可以用直覺的方式加入這個功能到 `bash` 或 `zsh` 之中。 +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`, `zsh`, `cmd` or `powershell`. -首先,定義一個改變視窗標題的函式(在 bash 與 zsh 之中都一樣): +First, define a window title change function (identical in bash and zsh): ```bash function set_win_title(){ - echo -ne "\033]0; 你的標題在此 \007" + echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007" } ``` -你可以利用變數來自定義這個標題(`$USER`、`$HOSTNAME` 與 `$PWD` 是很受歡迎的選項)。 +You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices). -在 `bash` 中,將這個函式設定為 Starship 的預執行函式: +In `bash`, set this function to be the precmd starship function: ```bash starship_precmd_user_func="set_win_title" ``` -在 `zsh` 中,將這個函式加入 `precmd_functions` 陣列: +In `zsh`, add this to the `precmd_functions` array: ```bash precmd_functions+=(set_win_title) ``` -如果你喜歡這個結果,把這幾行加入你的 shell 設定檔中(`~/.bashrc` or `~/.zsrhc`)來將此設為永久設定。 +If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent. For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`: @@ -80,6 +104,16 @@ function set_win_title(){ starship_precmd_user_func="set_win_title" ``` +For Cmd, you can change the window title using the `starship_preprompt_user_func` function. + +```lua +function starship_preprompt_user_func(prompt) + console.settitle(os.getenv('USERNAME').."@"..os.getenv('COMPUTERNAME')..": "..os.getcwd()) +end + +load(io.popen('starship init cmd'):read("*a"))() +``` + You can also set a similar output with PowerShell by creating a function named `Invoke-Starship-PreCommand`. ```powershell @@ -97,7 +131,7 @@ Some shells support a right prompt which renders on the same line as the input. 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). -`right_format` is currently supported for the following shells: elvish, fish, zsh. +`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd. ### 範例 @@ -117,13 +151,35 @@ Produces a prompt like the following: ▶ starship on rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s ``` +## Continuation Prompt + +Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote). + +Starship can set the continuation prompt using the `continuation_prompt` option. The default prompt is `"[∙](bright-black) "`. + +Note: `continuation_prompt` should be set to a literal string without any variables. + +Note: Continuation prompts are only available in the following shells: + + - `bash` + - `zsh` + - `PowerShell` + +### 範例 + +```toml +# ~/.config/starship.toml + +# A continuation prompt that displays two filled in arrows +continuation_prompt = "▶▶" +``` ## 風格字串 -風格字串是一個以空白分開的單詞清單。 單字並不會區分大小寫(換句話說,`bold` 與 `BoLd` 是被當作兩個相同的字串)。 每個單詞可以是下列其中之一: +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` - - `斜體字` + - `italic` - `underline` - `dimmed` - `inverted` @@ -132,14 +188,14 @@ Produces a prompt like the following: - `<color>` - `none` -其中 `<color>` 是指定顏色用的(下面解釋)。 `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. 單詞在字串中的順序不重要。 +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. -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` 與其他符號一起使用的情形視為是一種錯誤。 +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. -一個顏色指定符號可以是下列其中之一: +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-bit ANSI 色碼](https://i.stack.imgur.com/KTSQa.png)。 + - One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`). + - A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp). + - A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png). -如果前景/後景被指定了多種顏色,最後一個顏色具有最高優先性。 +If multiple colors are specified for foreground/background, the last one in the string will take priority. diff --git a/docs/zh-TW/config/README.md b/docs/zh-TW/config/README.md index 74da40cbe..c71552055 100644 --- a/docs/zh-TW/config/README.md +++ b/docs/zh-TW/config/README.md @@ -24,13 +24,19 @@ disabled = true 你可以透過更改環境變數 `STARSHIP_CONFIG` 來變更設定檔存放的位置: ```sh -export STARSHIP_CONFIG=~/.starship/config.toml +export STARSHIP_CONFIG=~/example/non/default/path/starship.toml ``` 等同於在 PowersShell(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') ``` ### Logging @@ -47,11 +53,17 @@ 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**):模組的子元件,主要是由模組提供的訊息。 舉例來說,在 "nodejs" 模組中提供的 "version" 變數代表著當下使用的 Node.js 版本。 +**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. By convention, most modules have a prefix of default terminal color (e.g. `via` in "nodejs") and an empty space as a suffix. @@ -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"` 設定粗體、斜體且紫色的文字 - `""` 明確地關閉所有風格 -注意風格產出的樣子取決於你的終端機模擬器。 例如,有些終端機模擬器會提升顏色的亮度而不是讓文字變粗體,而且有些色彩主題對一般與加亮顏色使用的是相同色碼。 除此之外,為了要有斜體字,你的終端機一定要支援斜體。 +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 ### Default Prompt Format -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` 模組顯示電池的電量以及現在的充電狀態。 這個模組只會在裝置的電量低於 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 = "💀 " ### 電池顯示 -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` 模組在你的文字輸入處旁顯示一個字元 (通常是箭頭)。 +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 ## 指令持續時間 -`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 trap +::: warning Do not hook the DEBUG trap in Bash -如果你在 `bash` 中使用 Starship,不要在執行 `eval $(starship init $0)` 之後設置 `DEBUG` trap,不然這個模組**會**壞掉。 +If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break. ::: -想使用類似 preexec 功能的 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`. ::: @@ -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)"` | The format for the module. | -| `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)"` | The format for the module. | +| `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` 模組顯示到現在資料夾的路徑,並裁減到前三層資料夾。 你的資料夾也會被裁減到你所在的 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 風格的 pwd 選項,將不會隱藏被裁減的資料夾,而是會根據你在選項中設定的數字看到每一層資料夾的縮寫。 +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` 是儲存庫的根目錄,而且該選項被設定為 `1`。 你會看到 `~/D/N/nixpkgs/pkgs`,而在這個設定之前則是 `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) "` | The format for the module. | -| `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) "` | The format for the module. | +| `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 的版本。 如果沒有的話,則顯示最新安裝的 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 t |