Skip to content

sprucelabsai/spaceship-prompt

 
 

Repository files navigation

spaceship →~ prompt
🚀⭐ Spaceship ZSH

Zsh prompt for Astronauts.

NPM Version CI Status Zsh Version Spaceship ZSH Twitter Donate

Built with ❤︎ by Denys Dovhan and contributors

THIS IS A FORK

For the official repo visit: https://github.com/denysdovhan/spaceship-prompt

Sprucebot custom Prompt

An enhanced prompt that works with the Spruce platform.

Installation of custom Sprucebot prompt

git clone https://github.com/sprucelabsai/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

Finally, open your ~/.zshrc file and set your theme:

ZSH_THEME="spaceship"

Recommended settings

To get a prompt that looks like the screenshot above, add these settings to the end of your ~/.zshrc file:

export SPACESHIP_DIR_TRUNC_REPO=false
export SPACESHIP_DIR_TRUNC=50
export SPACESHIP_DOCKER_SHOW=false
export SPACESHIP_KUBECONTEXT_SHOW=false
export SPACESHIP_EXIT_CODE_SHOW=true
export SPACESHIP_PROMPT_PREFIXES_SHOW=false
export SPACESHIP_CHAR_SYMBOL="╰─$ "
export SPACESHIP_GIT_BRANCH_COLOR=yellow
export SPACESHIP_GIT_BRANCH_PREFIX="<"
export SPACESHIP_GIT_BRANCH_SUFFIX=">"
export SPACESHIP_GIT_STATUS_SHOW=true
export SPACESHIP_TIME_SHOW=true
export SPACESHIP_PROMPT_ORDER=(
    time          # Time stampts section
    user          # Username section
    dir           # Current directory section
    line_sep      # Line break
    host          # Hostname section
    git           # Git section (git_branch + git_status)
    hg            # Mercurial section (hg_branch  + hg_status)
    package       # Package version
    node          # Node.js section
    sprucebot     # Prompt sprucebot
    ruby          # Ruby section
    elm           # Elm section
    elixir        # Elixir section
    xcode         # Xcode section
    swift         # Swift section
    golang        # Go section
    php           # PHP section
    rust          # Rust section
    haskell       # Haskell Stack section
    julia         # Julia section
    docker        # Docker section
    aws           # Amazon Web Services section
    venv          # virtualenv section
    conda         # conda virtualenv section
    pyenv         # Pyenv section
    dotnet        # .NET section
    ember         # Ember.js section
    kubecontext   # Kubectl context section
    terraform     # Terraform workspace section
    exec_time     # Execution time
    line_sep      # Line break
    battery       # Battery level and status
    vi_mode       # Vi-mode indicator
    jobs          # Background jobs indicator
    exit_code     # Exit code section
    char          # Prompt character
  )

Spaceship-Prompt Details

Spaceship is a minimalistic, powerful and extremely customizable Zsh prompt. It combines everything you may need for convenient work, without unnecessary complications, like a real spaceship.

Spaceship with Hyper and One Dark

Vist Troubleshooting for similar setup and find more examples with different color schemes in Screenshots wiki-page.

Features

  • Clever hostname and username displaying.
  • Prompt character turns red if the last command exits with non-zero code.
  • Current Git branch and rich repo status:
    • ? — untracked changes;
    • + — uncommitted changes in the index;
    • ! — unstaged changes;
    • » — renamed files;
    • — deleted files;
    • $ — stashed changes;
    • = — unmerged changes;
    • — ahead of remote branch;
    • — behind of remote branch;
    • — diverged changes.
  • Current Mercurial bookmark/branch and rich repo status:
    • ? — untracked changes;
    • + — uncommitted changes in the index;
    • ! — unstaged changes;
    • — deleted files;
  • Indicator for jobs in the background ().
  • Current Node.js version, through nvm/nodenv/n ().
  • Current Ruby version, through rvm/rbenv/chruby/asdf (💎).
  • Current Elm version (🌳)
  • Current Elixir version, through kiex/exenv/elixir (💧).
  • Current Swift version, through swiftenv (🐦).
  • Current Xcode version, through xenv (🛠).
  • Current Go version (🐹).
  • Current PHP version (🐘).
  • Current Rust version (𝗥).
  • Current version of Haskell GHC Compiler, defined in stack.yaml file (λ).
  • Current Julia version ().
  • Current Docker version and connected machine (🐳).
  • Current Amazon Web Services (AWS) profile (☁️) (Using named profiles).
  • Current Python virtualenv.
  • Current Conda virtualenv (🅒).
  • Current Python pyenv (🐍).
  • Current .NET SDK version, through dotnet-cli (.NET).
  • Current Ember.js version, through ember-cli (🐹).
  • Current Kubectl context (☸️).
  • Current Terraform workspace (🛠).
  • Package version, if there's is a package in current directory (📦).
  • Current battery level and status:
    • - charging;
    • - discharging;
    • - fully charged.
  • Current Vi-mode mode (with handy aliases for temporarily enabling).
  • Optional exit-code of last command (how to enable).
  • Optional time stamps 12/24hr in format (how to enable).
  • Execution time of the last command if it exceeds the set threshold.

Want more features? Please, open an issue or send pull request.

💡 Tip: Follow our Twitter to keep yourself updated about new features, improvements, and bugfixes.

Requirements

To work correctly, you will first need:

  • zsh (v5.2 or recent) must be installed.
  • Powerline Font must be installed and used in your terminal (for example, switch font to Fira Code).

Installing

Now that the requirements are satisfied, you can install Spaceship ZSH via any of the following tools.

💡 Tip: If you like this project and want to get some stickers and postcards, consider becoming a patron:

Become a patron
npm install -g spaceship-prompt

Done. This command should link spaceship.zsh as prompt_spaceship_setup to your $fpath and set prompt spaceship in .zshrc. Just reload your terminal.

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

Clone this repo:

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

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.

  • Follow prezto-contrib#usage to clone prezto-contrib to the proper location.
  • Enable the contrib-prompt module (before the prompt module).
  • Set zstyle ':prezto:module:prompt' theme 'spaceship' in your .zpreztorc.

Add the following snippet in your ~/.zshrc:

antigen theme denysdovhan/spaceship-prompt

Update your .zshrc file with the following line:

antibody bundle denysdovhan/spaceship-prompt

Add the following line to your ~/.zshrc where you're adding your other Zsh plugins:

zgen load denysdovhan/spaceship-prompt spaceship

Use this command in your .zshrc to load Spaceship as prompt theme:

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

Linux package manager

Arch Linux

Install the latest master from the AUR package spaceship-prompt-git:

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

Manual

If you have problems with approaches above, follow these instructions:

  • Clone this repo git clone https://github.com/denysdovhan/spaceship-prompt.git
  • Symlink spaceship.zsh to somewhere in $fpath as prompt_spaceship_setup.
  • Initialize prompt system and choose spaceship.

Example

Run echo $fpath to see possible location and link spaceship.zsh there, like:

$ ln -sf "$PWD/spaceship.zsh" "/usr/local/share/zsh/site-functions/prompt_spaceship_setup"

For a user-specific installation, simply add a directory to $fpath for that user in .zshrc:

fpath=( "$HOME/.zfunctions" $fpath )

Then install the theme like this:

$ ln -sf "$PWD/spaceship.zsh" "$HOME/.zfunctions/prompt_spaceship_setup"

For initializing prompt system add this to your .zshrc:

# .zshrc
autoload -U promptinit; promptinit
prompt spaceship

Customization

Spaceship works well out of the box, but you can customize almost everything if you want.

  • Options — Tweak section's behavior with tons of options.
  • API — Define a custom section that will do exactly what you want.

You have ability to customize or disable specific elements of Spaceship. All options must be overridden in your .zshrc file after the theme.

💡 Tip: Take a look at popular option presets or share your own configuration on Presets wiki page.

Troubleshooting

Having trouble? Take a look at out Troubleshooting page.

Still struggling? Please, file an issue, describe your problem and we will gladly help you.

Related Projects

Here's a list of related projects that have been inspired by Spaceship ZSH.

  • matchai/spacefish - A port of Spaceship ZSH for fish shell intending to achieve complete feature parity.

Team

Denys Dovhan Salmanul Farzy Maxim Baz
Denys Dovhan Salmanul Farzy Maxim Baz

Donate

Hi! I work on this project in my spare time, in addition to my primary job. I hope you enjoy using Spaceship ZSH. If you do, please, become my patron 🤝.

Patreon Bitcoin Ethereum
Become a patron 1FrPrQb6ACTkbSBAz9PduJWrDFfq41Ggb4 0x6aF39C917359897ae6969Ad682C14110afe1a0a1

This is your way make a clear statement: My work is valued.

I would appreciate your support! Thank you!

License

MIT © Denys Dovhan

Packages

No packages published

Languages

  • Shell 100.0%