Files
starship/docs/zh-TW/README.md
T

201 lines
4.5 KiB
Markdown
Raw Normal View History

---
2024-03-03 17:55:30 +01:00
layout: home
hero:
image: /logo.svg
2024-03-21 20:42:05 +09:00
text:
2024-03-03 17:55:30 +01:00
tagline: 適合任何 shell 的最小、極速、無限客製化的提示字元!
actions:
2024-03-21 20:42:05 +09:00
-
theme: brand
2024-03-03 17:55:30 +01:00
text: 馬上開始 →
link: ./guide/
2020-02-04 12:11:36 -05:00
features:
2024-03-21 20:42:05 +09:00
-
2022-12-05 15:54:12 +09:00
title: 相容性優先
2021-08-14 09:24:51 -04:00
details: 能夠在最常見的作業系統之中最常見的 shell 上運作。 在各處使用它吧!
2024-03-21 20:42:05 +09:00
-
2021-08-14 09:24:51 -04:00
title: 以 Rust 開發
details: 帶來同類中最快的速度以及 Rust 的安全性,讓你的提示字元盡可能快速與可靠。
2024-03-21 20:42:05 +09:00
-
2020-02-04 12:11:36 -05:00
title: 可客製化
details: 任何些微的細節都可以隨你喜愛地客製化,讓你的提示字元可以隨你所欲地最小化或是充滿各種特色。
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 提示字元"
2024-03-30 00:42:36 +09:00
description: Starship 是適合任何 shell 的最小、極速、高度客製化的提示字元! 顯示你需要的訊息,同時保持順暢與最小化。 有針對 Bash、Fish、ZSH、Ion 、Tcsh、Elvish、Nu、Xonsh、Cmd 與 Powershell 的快速安裝指南。
---
2024-05-16 02:07:00 +09:00
<script setup>
import { onMounted } from 'vue'
onMounted(() => {
const urlParams = new URLSearchParams(window.location.search)
if (urlParams.has('uwu') || urlParams.has('kawaii')) {
const img = document.querySelector('.VPHero .VPImage.image-src')
img.classList.add('uwu')
img.src = '/logo-uwu.png'
img.alt = 'Kawaii Starship Logo by @sawaratsuki1004'
}
})
</script>
2024-03-21 20:42:05 +09:00
<video class="demo-video" muted autoplay loop playsinline>
<source src="/demo.webm" type="video/webm">
<source src="/demo.mp4" type="video/mp4">
</video>
2021-04-22 17:12:09 -04:00
### 先決要求
2023-04-11 13:05:27 +09:00
- 安裝 [Nerd Font](https://www.nerdfonts.com/) 字型,並在終端機中啟用。
2021-04-22 17:12:09 -04:00
2021-05-01 14:20:08 -04:00
### 快速安裝
1. 安裝 **starship** 執行檔:
2021-03-15 13:18:42 -04:00
#### 安裝最新版本
2021-03-15 13:18:42 -04:00
使用 Shell 安裝:
```sh
2022-03-08 21:11:36 -05:00
curl -sS https://starship.rs/install.sh | sh
```
2022-03-08 21:11:36 -05:00
2021-06-20 14:10:36 -04:00
如果想更新已安裝的 Starship,請重新執行上述指令。 指令只會更新 Starship 執行檔本身,不會影響到任何已撰寫的設定檔。
2021-03-15 13:18:42 -04:00
#### 使用套件管理器安裝:
2021-04-08 11:52:32 -04:00
使用 [Homebrew](https://brew.sh/)
```sh
2019-12-24 16:54:29 -05:00
brew install starship
```
2024-03-21 20:42:05 +09:00
2024-03-30 00:42:36 +09:00
使用 [Winget](https://github.com/microsoft/winget-cli)
2019-12-24 16:54:29 -05:00
```powershell
2022-10-14 21:53:32 -04:00
winget install starship
```
1. 將初始化腳本 (script) 加入你的 shell 的設定檔:
#### Bash
將以下內容放到 `~/.bashrc` 的結尾:
```sh
# ~/.bashrc
eval "$(starship init bash)"
```
#### Fish
將以下內容放到 `~/.config/fish/config.fish` 的結尾:
```sh
# ~/.config/fish/config.fish
starship init fish | source
```
#### Zsh
將以下內容放到 `~/.zshrc` 的結尾:
```sh
# ~/.zshrc
eval "$(starship init zsh)"
```
#### 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`。
```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
2024-03-30 00:42:36 +09:00
只有支援 elvish v0.18 或以上版本。
2022-05-24 17:19:44 -04:00
:::
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
2025-01-12 00:23:14 +09:00
這項設定未來會改變。 Only Nushell v0.96+ is supported.
2022-05-24 17:19:44 -04:00
:::
2025-01-12 00:23:14 +09:00
Add the following to the end of your Nushell configuration (find it by running `$nu.config-path` in Nushell):
2024-03-21 20:42:05 +09:00
2022-03-24 15:47:11 -05:00
```sh
2025-01-12 00:23:14 +09:00
mkdir ($nu.data-dir | path join "vendor/autoload")
starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu")
2022-03-24 15:47:11 -05:00
```
2021-08-14 09:24:51 -04:00
2023-07-30 09:29:01 -04:00
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
2022-12-05 15:54:12 +09:00
#### 命令提示字元
2022-01-15 17:08:31 -05:00
2024-03-30 00:42:36 +09:00
您需要在 Cmd 中使用 [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+)。 新增下列的內容到檔案 `starship.lua` 中並將這個檔案存放在 Clink scripts 的路徑下方:
2022-01-15 17:08:31 -05:00
```lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
```