2019-10-04 17:57:43 +09:00
---
home: true
heroImage: /logo.svg
2020-02-04 12:11:36 -05:00
heroText:
2020-11-28 23:45:59 -05:00
tagline: 轻量级、反应迅速,可定制的高颜值终端!
2019-10-21 23:42:08 +09:00
actionText: 入门 →
2020-02-02 19:51:45 -05:00
actionLink: ./guide/
2020-02-04 12:11:36 -05:00
features:
-
title: 兼容性优先
details: Starship 可以在各种常见的操作系统和常见的 shell 上运行。 尝试着在各种地方使用它吧!
-
title: 使用 Rust 编写
details: 具有 Rust 独树一帜的速度与安全性,使你的提示符尽可能的快速可靠。
-
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
metaTitle: "Starship:可用于各种 Shell 的提示符"
2022-05-24 17:19:44 -04:00
description: Starship是一款轻量级、反应迅速、可自定义的高颜值终端! Shows the information you need, while staying sleek and minimal. 可以为Bash、Fish、ZSH、Ion、Tcsh、Elvish、Nu、Xonsh、Cmd和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
### 前置要求
2022-05-24 17:19:44 -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
2020-02-04 12:11:36 -05:00
#### 安装最新版本
2019-10-04 17:57:43 +09:00
2020-02-04 12:11:36 -05: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
2022-01-15 17:08:31 -05:00
自更新 Starship ,运行下面脚本 将会在不改动 Starship 配置文件的情况下升级版本
2019-10-04 17:57:43 +09:00
2020-02-04 12:11:36 -05: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
` ``
2020-02-04 12:11:36 -05: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. 将初始化脚本添加到您的 shell 的配置文件:
2019-10-04 17:57:43 +09:00
#### Bash
2019-10-21 23:42:08 +09:00
在 ` ~/.bashhrc` 的最后,添加以下内容:
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-01-03 03:56:07 -05:00
将以下内容添加到 ` Microsoft.PowerShell_profile.ps1`。 你可以在 PowerShell 通过 ` $PROFILE` 变量来查询文件的位置。 对于 -Nix 来说,通常文件路径是 ` ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` 或 ` ~/.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
2020-02-04 12:11:36 -05: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
2022-01-15 17:08:31 -05:00
在 ` ~/.config/fish/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
2022-01-15 17:08:31 -05:00
在 ` ~/.bashhrc` 的最后,添加以下内容:
2021-03-15 13:18:42 -04:00
` ``sh
# ~/.tcshrc
eval ` starship init tcsh`
` ``
2021-07-10 17:15:23 -04:00
2021-08-14 09:24:51 -04:00
#### Nushell
2021-07-10 17:15:23 -04:00
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-02-07 15:53:55 +01:00
在 ` ~/.bashhrc` 的最后,添加以下内容:
2021-08-14 09:24:51 -04:00
` ``sh
# ~/.xonshrc
execx($(starship init xonsh))
` ``
2022-01-15 17:08:31 -05:00
#### Cmd
2022-04-18 09:48:28 -05:00
您需要使用 [Clink](https://chrisant996.github.io/clink/clink.html) (v1.2.30+) 与 Cmd. 将以下文件添加到文件 ` starship.lua` 中,并将此文件放置在 Clink脚本目录中:
2022-01-15 17:08:31 -05:00
` ``lua
-- starship.lua
load(io.popen('starship init cmd'):read("*a"))()
` ``