跳转至

快速上手

欢迎登船! Let's install Spaceship on your machine, astronaut!

安装要求

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 you 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" #> 
    

安装

如果满足了这些要求,您可以通过以下任何方式安装 Spaceship:

Hint

If you're using any plugin manager, like Oh-My-Zsh, antigen, zgen, zplug or other, this might not be the best way to install Spaceship for you.

  1. Clone this repo somewhere, for example to $HOME/.zsh/spaceship.
  2. Source Spaceship in your ~/.zshrc.

示例

Terminal
mkdir -p "$HOME/.zsh"
git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git "$HOME/.zsh/spaceship"

为了初始化命令提示系统,需要将其添加到您的 .zshrc 中:

.zshrc
source "$HOME/.zsh/spaceship/spaceship.zsh"

Installing Spaceship via Homebrew is a simple command:

Terminal
brew install spaceship

Add prompt initialization to your .zshrc:

Terminal
echo "source $(brew --prefix)/opt/spaceship/spaceship.zsh" >>! ~/.zshrc

Tip

You can also add the following to your Brewfile to bundle Spaceship along with your other software:

Brewfile
brew "spaceship"

克隆此仓库:

Terminal
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1

spaceship.zsh-theme 软链到您 oh-my-zsh 的自定义主题目录:

Terminal
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

.zshrc 中设置 `ZSH_THEME="spaceship"。

Install Spaceship via npm as you would with any other global package:

Terminal
npm install -g spaceship-prompt

This command will download Spaceship. It will also ask you to source Spaceship in your ~/.zshrc file.

Tip

Update Spaceship to new versions as you would any other package.

  • 遵循 prezto-contrib#usage使用守则prezto-contrib 克隆到正确的位置。
  • 启用 contrib-prompt 模块(并且将其放在 prompt 模块之前)。
  • 在您的 .zpreztorc 中设置 zstyle ':prezto:module:prompt' theme 'spaceship'

Add Spaceship to your .zimrc:

.zimrc
zmodule spaceship-prompt/spaceship-prompt --name spaceship --no-submodules

Then install Spaceship:

Terminal
zimfw install

将以下代码片段添加到您的 .zshrc中:

.zshrc
antigen theme spaceship-prompt/spaceship-prompt

使用以下行更新您的.zshc文件:

.zshrc
antibody bundle spaceship-prompt/spaceship-prompt

将以下行添加到 .zshrc中您要添加其他 Zsh 插件的地方:

.zshrc
zinit light spaceship-prompt/spaceship-prompt

将以下行添加到 .zshrc中您要添加其他 Zsh 插件的地方:

.zshrc
zgen load spaceship-prompt/spaceship-prompt spaceship

在你的.zshrc中使用此命令加载 Spaceship 以使其作为命令提示系统的主题:

.zshrc
zplug "spaceship-prompt/spaceship-prompt", use:spaceship.zsh, from:github, as:theme

Add the following to your plugins.toml file (open it with sheldon edit):

plugins.toml
[plugins.spaceship]
github = "spaceship-prompt/spaceship-prompt"

Or run the following to automatically add it:

Terminal
sheldon add spaceship --github spaceship-prompt/spaceship-prompt

从 AUR 软件源安装最近的版本 spaceship-prompt-git:

git clone https://aur.archlinux.org/spaceship-prompt-git.git --depth=1
cd spaceship-prompt-git
makepkg -si

恭喜您!

你已经成功了! 你已经在你的机器上安装了 Spaceship!

下一步是什么? Spaceship 有合理的默认设置,但您可能想要根据需要调整它们。 Learn how to configure your Spaceship:

Configure Spaceship

Additionally, join our community or consider contributing to the project.

Contribute Twitter Discord

遇到问题?

Find answers on our troubleshooting page or get help by our community. 仍然困惑? Please, file an issue, describe your problem, and we will gladly help you.

Discord Discussions Issues