2019-10-04 17:57:43 +09:00
---
home: true
heroImage: /logo.svg
2020-02-04 12:11:36 -05:00
heroText:
2021-03-15 13:18:42 -04:00
tagline: 適合任何 shell 的最小、極速、無限客製化的提示字元!
actionText: 馬上開始 →
2020-02-02 19:51:45 -05:00
actionLink: ./guide/
2020-02-04 12:11:36 -05:00
features:
-
title: 兼容性優先
2021-08-14 09:24:51 -04:00
details: 能夠在最常見的作業系統之中最常見的 shell 上運作。 在各處使用它吧!
2020-02-04 12:11:36 -05:00
-
2021-08-14 09:24:51 -04:00
title: 以 Rust 開發
details: 帶來同類中最快的速度以及 Rust 的安全性,讓你的提示字元盡可能快速與可靠。
2020-02-04 12:11:36 -05:00
-
title: 可客製化
details: 任何些微的細節都可以隨你喜愛地客製化,讓你的提示字元可以隨你所欲地最小化或是充滿各種特色。
2019-10-04 17:57:43 +09:00
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
2020-02-04 12:11:36 -05:00
#Used for the description meta tag, for SEO
2021-03-15 13:18:42 -04:00
metaTitle: "Starship:跨 Shell 提示字元"
2022-01-15 17:08:31 -05:00
description: Starship 是適合任何 shell 的最小、極速、高度客製化的提示字元! 顯示你需要的訊息,同時保持順暢與最小化。 Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
2019-10-04 17:57:43 +09:00
---
<div class="center">
2019-12-14 18:46:45 -05:00
<video class="demo-video" muted autoplay loop playsinline>
2019-10-04 17:57:43 +09:00
<source src="/demo.webm" type="video/webm">
<source src="/demo.mp4" type="video/mp4">
</video>
</div>
2021-04-22 17:12:09 -04:00
### 先決要求
2021-08-14 09:24:51 -04:00
- 安裝至少一個 [Nerd Font ](https://www.nerdfonts.com/ ) 字體,並在終端中啟用。
2021-04-22 17:12:09 -04:00
2021-05-01 14:20:08 -04:00
### 快速安裝
2019-10-04 17:57:43 +09:00
2019-10-21 23:42:08 +09:00
1. 安裝 **starship ** 執行檔:
2019-10-04 17:57:43 +09:00
2021-03-15 13:18:42 -04:00
#### 安裝最新版本
2019-10-04 17:57:43 +09:00
2021-03-15 13:18:42 -04:00
使用 Shell 安裝:
2019-10-04 17:57:43 +09:00
```sh
2022-03-08 21:11:36 -05:00
curl -sS https://starship.rs/install.sh | sh
2019-10-04 17:57:43 +09:00
` ``
2022-03-08 21:11:36 -05:00
2021-06-20 14:10:36 -04:00
如果想更新已安裝的 Starship,請重新執行上述指令。 指令只會更新 Starship 執行檔本身,不會影響到任何已撰寫的設定檔。
2019-10-04 17:57:43 +09:00
2021-03-15 13:18:42 -04:00
#### 使用套件管理器安裝:
2019-10-04 17:57:43 +09:00
2021-04-08 11:52:32 -04:00
使用 [Homebrew](https://brew.sh/):
2019-10-04 17:57:43 +09:00
` ``sh
2019-12-24 16:54:29 -05:00
brew install starship
2019-10-04 17:57:43 +09:00
` ``
2021-03-15 13:18:42 -04:00
使用 [Scoop](https://scoop.sh):
2019-10-04 17:57:43 +09:00
2019-12-24 16:54:29 -05:00
` ``powershell
scoop install starship
2019-10-04 17:57:43 +09:00
` ``
2019-10-21 23:42:08 +09:00
1. 將初始化腳本 (script) 加入你的 shell 的設定檔:
2019-10-04 17:57:43 +09:00
#### Bash
2019-10-21 23:42:08 +09:00
將以下內容放到 ` ~/.bashrc` 的結尾:
2019-10-04 17:57:43 +09:00
` ``sh
# ~/.bashrc
eval "$(starship init bash)"
` ``
#### Fish
2019-10-21 23:42:08 +09:00
將以下內容放到 ` ~/.config/fish/config.fish` 的結尾:
2019-10-04 17:57:43 +09:00
` ``sh
# ~/.config/fish/config.fish
2019-10-29 12:48:45 +09:00
starship init fish | source
2019-10-04 17:57:43 +09:00
` ``
#### Zsh
2019-10-21 23:42:08 +09:00
將以下內容放到 ` ~/.zshrc` 的結尾:
2019-10-04 17:57:43 +09:00
` ``sh
# ~/.zshrc
eval "$(starship init zsh)"
` ``
2019-10-21 23:42:08 +09:00
#### Powershell
2021-08-14 09:24:51 -04:00
將以下內容放到 ` Microsoft.PowerShell_profile.ps1` 的結尾。 你可以藉由在 PowerShell 查詢 ` $PROFILE` 變數以取得這個檔案的位置。 一般來說,檔案會出現在 ` ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`,若是在 -Nix 上,檔案則會出現在 ` ~/.config/powershell/Microsoft.PowerShell_profile.ps1`。
2019-10-21 23:42:08 +09:00
` ``sh
Invoke-Expression (&starship init powershell)
` ``
2019-12-24 16:54:29 -05:00
#### Ion
2021-03-15 13:18:42 -04:00
將以下內容放到 ` ~/.config/ion/initrc` 的結尾:
2019-12-24 16:54:29 -05:00
` ``sh
# ~/.config/ion/initrc
eval $(starship init ion)
` ``
2021-02-06 12:46:15 -05:00
2021-08-14 09:24:51 -04:00
2021-02-06 12:46:15 -05:00
#### Elvish
2022-05-24 17:19:44 -04:00
::: warning
Only elvish v0.18 or higher is supported.
:::
2021-02-06 12:46:15 -05:00
2021-03-15 13:18:42 -04:00
將以下內容放到 ` ~/.elvish/rc.elv` 的結尾:
2021-02-06 12:46:15 -05:00
` ``sh
# ~/.elvish/rc.elv
eval (starship init elvish)
` ``
2021-03-15 13:18:42 -04:00
#### Tcsh
將以下內容放到 ` ~/.tcshrc` 的結尾:
` ``sh
# ~/.tcshrc
eval ` starship init tcsh`
` ``
2021-07-10 17:15:23 -04:00
2021-08-14 09:24:51 -04:00
#### Nushell
2022-05-24 17:19:44 -04:00
::: warning
This will change in the future. Only Nushell v0.61+ is supported.
:::
Add the following to to the end of your Nushell env file (find it by running ` $nu.env-path` in Nushell):
2022-03-24 15:47:11 -05:00
` ``sh
mkdir ~/.cache/starship
starship init nu | save ~/.cache/starship/init.nu
2021-07-10 17:15:23 -04:00
` ``
2021-08-14 09:24:51 -04:00
2022-03-24 15:47:11 -05:00
And add the following to the end of your Nushell configuration (find it by running ` $nu.config-path`):
` ``sh
source ~/.cache/starship/init.nu
` ``
2021-08-14 09:24:51 -04:00
#### Xonsh
2022-03-24 15:47:11 -05:00
將以下內容加到 ` ~/.xonshrc` 的結尾:
2021-08-14 09:24:51 -04:00
` ``sh
# ~/.xonshrc
execx($(starship init xonsh))
` ``
2022-01-15 17:08:31 -05:00
#### 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"))()
` ``