站内导读
中文 Spaceship 是一款面向 Zsh 的极简提示符,在命令行中集中展示主机名、Git 与 Mercurial 仓库状态、Node.js、Rust、Python 等运行时版本、Docker 版本与 Kubernetes 上下文、包版本、电量及后台任务标记。它解决的是多环境切换时信息分散的问题,支持按需自定义 section。适合日常在终端中工作的开发者,需 Zsh 5.2 以上及 Powerline 或 Nerd 字体。
日本語 Spaceship は Zsh 向けのミニマルなプロンプトで、ホスト名やユーザー名、Git・Mercurial のリポジトリ状態、Node.js や Rust、Python などの実行環境、Docker のバージョンと Kubernetes コンテキスト、パッケージのバージョン、バッテリー残量、バックグラウンドジョブの有無をコマンドライン上にまとめて表示します。複数環境を行き来する際の情報確認を減らしたい開発者向けで、Zsh 5.2 以降と Powerline または Nerd Font が必要です。
한국어 Spaceship은 Zsh용 미니멀 프롬프트로, 호스트명과 사용자명, Git 및 Mercurial 저장소 상태, Node.js와 Rust, Python 등 런타임 버전, Docker 버전과 Kubernetes 컨텍스트, 패키지 버전, 배터리 상태, 백그라운드 작업 표시를 한 줄에 보여줍니다. 여러 환경을 오가며 정보를 확인하는 번거로움을 줄이려는 개발자에게 적합하며, Zsh 5.2 이상과 Powerline 또는 Nerd Font가 필요합니다. 섹션을 직접 정의해 표시 항목을 조정할 수 있습니다.
English Spaceship is a minimal Zsh prompt that surfaces hostname and username, Git and Mercurial repository status, runtime versions for Node.js, Rust, Python and others, Docker version and Kubernetes context, package versions, battery state and background job markers in one line. It reduces the need to check environment details manually when switching between projects. It suits developers who work mainly in the terminal and requires Zsh 5.2 or newer plus a Powerline or Nerd Font.
README · 详细文档
来源 · 查看原文
<h1 align="center"> <a href="https://github.com/spaceship-prompt/spaceship-prompt"> <img alt="spaceship →~ prompt" src="https://cloud.githubusercontent.com/assets/3459374/21679181/46e24706-d34b-11e6-82ee-5efb3d2ba70f.png" width="400"> </a> <br>Spaceship Prompt 🚀⭐<br> </h1>
<h4 align="center"> Minimalistic, powerful and extremely customizable <a href="http://zsh.org" target="_blank"><code>Zsh</code></a> prompt </h4>
<p align="center"> <a href="https://npmjs.org/package/spaceship-prompt"> <img src="https://img.shields.io/npm/v/spaceship-prompt.svg?style=flat-square" alt="NPM Version" /> </a>
<a href="https://github.com/spaceship-prompt/spaceship-prompt/actions"> <img src="https://img.shields.io/github/actions/workflow/status/spaceship-prompt/spaceship-prompt/validate.yaml?style=flat-square" alt="GitHub Workflow Status" /> </a>
<a href="http://zsh.org/"> <img src="https://img.shields.io/badge/zsh-%3E%3Dv5.2-777777.svg?style=flat-square" alt="Zsh Version" /> </a>
<a href="https://twitter.com/SpaceshipPrompt"> <img src="https://img.shields.io/badge/twitter-%40SpaceshipZSH-00ACEE.svg?style=flat-square" alt="Spaceship Twitter" /> </a>
<a href="https://discord.gg/NTQWz8Dyt9"> <img src="https://img.shields.io/discord/859409950999707668?label=discord&logoColor=white&style=flat-square" alt="Chat on Discord" /> </a>
<a href="https://patreon.com/denysdovhan"> <img src="https://img.shields.io/badge/support-patreon-F96854.svg?style=flat-square" alt="Donate" /> </a> </p>
<div align="center"> <h4> <a href="https://spaceship-prompt.sh">Website</a> | <a href="https://spaceship-prompt.sh/getting-started">Installation</a> | <a href="https://spaceship-prompt.sh/config/intro">Configuration</a> | <a href="https://spaceship-prompt.sh/advanced/creating-section">Advanced Usage</a> </h4> </div>
<div align="center"> <sub>Built with ❤︎ by <a href="https://denysdovhan.com">Denys Dovhan</a> and <a href="https://github.com/spaceship-prompt/spaceship-prompt/graphs/contributors">contributors </a> </div> <br>
Spaceship is a minimalistic, powerful and extremely customizable [Zsh][zsh-url] prompt. Prompt is what you see when you type a command. It can show a lot of useful tips, saving your time and making the user experience smooth and pleasant. It combines everything you may need for convenient work, without unnecessary complications, like a real spaceship.
<p align="center"> <a href="https://asciinema.org/a/513451"> <img alt="Spaceship with One Dark, zsh-autosuggestions and zsh-syntax-highlight" src="https://user-images.githubusercontent.com/3459374/183478313-5aa02cbe-fafc-42e0-a791-ea08a0902f56.gif" width="80%"> </a> <br> <sup>Visit <a href="https://deploy-preview-963--spaceship-prompt.netlify.app/faq/#why-doesnt-my-prompt-look-like-the-preview">Frequently Asked Question</a> for similar setup and find more examples with different color schemes in <a href="https://github.com/spaceship-prompt/spaceship-prompt/wiki/Screenshots">Screenshots </a>wiki-page. </sup> </p>
✨ Features
Here are some sneak peeks of what Spaceship can show:
- Clever hostname and username displaying
- Repository statuses (Git and Mercurial are supported)
- Runtime environments for various languages (Node.js, Rust, Python, Ruby, Swift, Go, PHP and many others)
- Docker version, Kubernetes context and connected machine
- Package version (npm, lerna, cargo, composer and others)
- Battery level and status
- Indicator for jobs in the background
✦ - A lot of useful information
- Custom information of your choice
Want more features? Please, open an issue or send a pull request.
🤝 Requirements
Before we begin, let's make sure you have the following installed:
- Zsh (v5.2 or recent) must be installed. Run the following command to check your version of Zsh:
echo $ZSH_VERSION # 5.8.1
- Powerline Font or Nerd Font (even better) must be installed and used in your terminal. Fira Code is a popular choice. To check if Powerline Font works for you, run:
echo -e "\xee\x82\xa0" #
🚀 Installation
Here are a few popular methods to install Spaceship. Select the one you use from the list below:
<details> <summary>Homebrew</summary> Installing Spaceship via Homebrew is a simple command:
brew install spaceship
Add prompt initialization to your .zshrc:
echo "source $(brew --prefix)/opt/spaceship/spaceship.zsh" >>! ~/.zshrc
</details>
<details> <summary>Oh-My-Zsh</summary> Clone this repo:
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
Symlink spaceship.zsh-theme to your oh-my-zsh custom themes directory:
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
Set ZSH_THEME="spaceship" in your .zshrc. </details>
<details> <summary>npm</summary> Install Spaceship via npm as you would with any other global package:
npm install -g spaceship-prompt
This command will download Spaceship. It will also ask you to source Spaceship in your ~/.zshrc file.
</details>
<details> <summary>prezto</summary>
- Follow prezto-contrib#usage to clone
prezto-contribto the proper location. - Enable the
contrib-promptmodule (before thepromptmodule). - Set
zstyle ':prezto:module:prompt' theme 'spaceship'in your.zpreztorc.
</details>
<details> <summary>zim</summary> Add Spaceship to your .zimrc:
zmodule spaceship-prompt/spaceship-prompt --name spaceship --no-submodules
Then, install Spaceship:
zimfw install
</details>
<details> <summary>antigen</summary> Add the following snippet in your .zshrc:
antigen theme spaceship-prompt/spaceship-prompt
</details>
<details> <summary>antibody</summary> Update your .zshrc file with the following line:
antibody bundle spaceship-prompt/spaceship-prompt
</details>
<details> <summary>zinit</summary> Add the following line to your .zshrc where you're adding your other Zsh plugins:
zinit light spaceship-prompt/spaceship-prompt
</details>
<details> <summary>zgen</summary> Add the following line to your .zshrc where you're adding your other Zsh plugins:
zgen load spaceship-prompt/spaceship-prompt spaceship
</details>
<details> <summary>zplug</summary> Use this command in your .zshrc to load Spaceship as prompt theme:
zplug "spaceship-prompt/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
</details>
<details> <summary>sheldon</summary> Add the following to your plugins.toml file (open it with sheldon edit):
[plugins.spaceship]
github = "spaceship-prompt/spaceship-prompt"
Or run the following to automatically add it:
sheldon add spaceship --github spaceship-prompt/spaceship-prompt
</details>
<details> <summary>Arch</summary>
Install the latest release from the AUR package spaceship-prompt:
git clone https://aur.archlinux.org/spaceship-prompt.git
cd spaceship-prompt
makepkg -si
or using yay:
yay -S spaceship-prompt
Also there is an unmaintained git package spaceship-prompt-git. </details>
<details> <summary>Manual</summary>
If none of the above methods works for you, you can install Spaceship manually.
- Clone this repo somewhere, for example to
$HOME/.zsh/spaceship. - Source Spaceship in your
~/.zshrc.
Example
mkdir -p "$HOME/.zsh"
git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git "$HOME/.zsh/spaceship"
For initializing prompt system, add this to your .zshrc:
source "$HOME/.zsh/spaceship/spaceship.zsh"
</details>
⚙️ Configuration
Spaceship works well out of the box, but you can customize almost everything if you want.
- **⚙️ Configuration** — Tweak the section's behavior with tons of options.
- **😎 Advanced Usage** — Learn how to create a custom section, benefit of per-directory configuration and more.
Additionally, join our community in Discord and follow our Twitter for updates.
🫶 Contributing
We're glad to accept contributions from developers of all skill levels! If you are interested in contributing to Spaceship, please take a look at our Contribution Guide for more details. If you're looking for an easy way into the project, take one of the issues with **good first issue** label.
If you are fluent in any other language besides English, we greatly appreciate any help with translating our documentation in other languages. If you would like to help, join the team of translators on our Crowdin.
If you're interested in helping other people, answer questions asked by other users of Spaceship and help to solve their issues. Additionally, join our **Discord** to discuss Spaceship and help people who need help.
💌 Sponsoring
If you really enjoy this project, you can contribute financially. Any contribution is highly appreciated, even the smallest one. There are several ways to donate:
- Recurring donations:
GitHub Sponsors Open Collective * Patreon
- One-time donations:
GitHub Sponsors Buy Me A Coffee
- Crypto donations:
Ethereum: 0x5C9496De5E51D48daf28354DC04d8f9D33955559 Bitcoin: bc1q5ezjvpgftmx42f9qgdf5lscjz43uh4jf02uvje
🤔 Having trouble?
Find answers on our troubleshooting page or get help from our community.
**Issues** • **Discussions** • **Discord**
Still struggling? Please, *file an issue*, describe your problem, and we will gladly help you.
👀 Derived Projects
Here's a list of related projects that have been inspired by Spaceship ZSH.
- **denysdovhan/dotfiles** - Dotfiles of Spaceship's author from which Spaceship is originated.
- **matchai/spacefish** - A port of Spaceship ZSH for fish shell intending to achieve complete feature parity.
- **starship/starship** - A blazing-fast, cross-shell prompt written in Rust, heavily inspired by Spaceship ZSH.
📄 License
MIT © Denys Dovhan
<!-- References --> [zsh-url]: http://zsh.org/ [patreon-url]: https://www.patreon.com/denysdovhan