Spaceship-prompt - A Zsh prompt for Astronauts

Overview

spaceship →~ prompt
🚀 Spaceship ZSH

Zsh prompt for Astronauts.

NPM Version GitHub Workflow Status Zsh Version Spaceship Twitter Chat on Discord Donate

Built with ❤︎ by Denys Dovhan and contributors

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

Visit 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 fnm/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 Google Cloud Platform gcloud active configuration (☁️).
  • 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 (🛠).
  • Current IBM Cloud account (👔).
  • 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.
  • Optional AWS now supports aws-vault (aws-vault)

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

Homebrew

brew install spaceship

You can also add the following to your Brewfile:

brew "spaceship"

npm

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. Ensure that you have enabled post-scripts in npm by npm config set ignore-scripts false before starting installation.

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

oh-my-zsh

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.

prezto

  • 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.

zim

Add zmodule spaceship-prompt/spaceship-prompt --name spaceship to your .zimrc and run zimfw install.

antigen

Add the following snippet in your .zshrc:

antigen theme spaceship-prompt/spaceship-prompt

antibody

Update your .zshrc file with the following line:

antibody bundle spaceship-prompt/spaceship-prompt

zinit

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

zinit light spaceship-prompt/spaceship-prompt

zgen

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

zgen load spaceship-prompt/spaceship-prompt spaceship

zplug

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

zplug "spaceship-prompt/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 --depth=1
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/spaceship-prompt/spaceship-prompt.git --depth=1
  • 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=( "${ZDOTDIR:-$HOME}/.zfunctions" $fpath )

Then install the theme like this:

$ ln -sf "$PWD/spaceship.zsh" "${ZDOTDIR:-$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 the ability to customize or disable specific elements of Spaceship. Set options and define new sections in your .zshrc file, after the theme. To include a custom section you have defined in your prompt, add it to the SPACESHIP_PROMPT_ORDER.

For example:

# .zshrc

# add Spaceship (differs by setup, see Installating above)

section_mysection() {
  # ...
}

SPACESHIP_PROMPT_ORDER=(<any preceding sections> mysection <any following sections>)

To append custom sections to the default Spaceship prompt, follow the form:

SPACESHIP_PROMPT_ORDER=($SPACESHIP_PROMPT_ORDER mysection)

To prepend custom sections to the default Spaceship prompt, follow the form:

SPACESHIP_PROMPT_ORDER=(mysection $SPACESHIP_PROMPT_ORDER)

💡 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.
  • starship/starship - A blazing-fast, cross-shell prompt written in Rust, heavily inspired by Spaceship ZSH.

Team

Denys Dovhan Salmanul Farzy Maxim Baz Runrioter Wung
Denys Dovhan Salmanul Farzy Maxim Baz Runrioter Wung

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

Comments
  • Incorrect display after upgrade to v2

    Incorrect display after upgrade to v2

    I have an extra word green} before

    vagrant at vm in ~ via ⬢  v7.8.0 on 🐳  v1.13.1 
    green}➜ 
    

    ~/.zshrc:

    # Path to your oh-my-zsh configuration.
    ZSH=$HOME/.oh-my-zsh
    
    # Set name of the theme to load.
    # Look in ~/.oh-my-zsh/themes/
    # Optionally, if you set this to "random", it'll load a random theme each
    # time that oh-my-zsh is loaded.
    #ZSH_THEME="robbyrussell"
    #ZSH_THEME="juanghurtado"
    ZSH_THEME="spaceship"
    
    # Example aliases
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"
    
    if [ -f ~/.zsh_aliases ]; then 
        . ~/.zsh_aliases
    fi 
    
    # Set to this to use case-sensitive completion
    # CASE_SENSITIVE="true"
    
    # Uncomment this to disable bi-weekly auto-update checks
    # DISABLE_AUTO_UPDATE="true"
    
    # Uncomment to change how often before auto-updates occur? (in days)
    # export UPDATE_ZSH_DAYS=13
    
    # Uncomment following line if you want to disable colors in ls
    # DISABLE_LS_COLORS="true"
    
    # Uncomment following line if you want to disable autosetting terminal title.
    # DISABLE_AUTO_TITLE="true"
    
    # Uncomment following line if you want to disable command autocorrection
    # DISABLE_CORRECTION="true" 
    # Uncomment following line if you want red dots to be displayed while waiting for completion
    # COMPLETION_WAITING_DOTS="true"
    
    # Uncomment following line if you want to disable marking untracked files under
    # VCS as dirty. This makes repository status check for large repositories much,
    # much faster.
    # DISABLE_UNTRACKED_FILES_DIRTY="true"
    
    # Uncomment following line if you want to  shown in the command execution time stamp 
    # in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
    # yyyy-mm-dd
    # HIST_STAMPS="mm/dd/yyyy"
    
    # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
    # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
    # Example format: plugins=(rails git textmate ruby lighthouse)
    plugins=(git cp docker docker-compose vagrant command-not-found fish-init debian pip ssh-agent autojump nvm fabric)
    
    source $ZSH/oh-my-zsh.sh
    # conflict with silversearcher-ag
    unalias ag
    [[ -n "${key[Up]}"      ]] && bindkey  "${key[Up]}"      history-search-backward
    [[ -n "${key[Down]}"    ]] && bindkey  "${key[Down]}"    history-search-forward
    if type fish-init > /dev/null; then
        alias finit=fish-init
    fi
    
    # User configuration
    
    #export PATH=$HOME/bin:/usr/local/bin:/usr/local/go/bin:$PATH
    # export MANPATH="/usr/local/man:$MANPATH"
    # http proxy
    #dpkg-query -W squid3 2>&1 1>/dev/null && export http_proxy=http://127.0.0.1:3128
    # DISPLAY
    remote_ip=`env | awk '$0 ~ /^SSH_CLIENT=/ {print substr($1, index($1, "=") + 1)}'`
    if [ ! -z "$remote_ip" ] ; then
        export DISPLAY=$remote_ip:0
        echo DISPLAY=$DISPLAY
    fi
    # pythonbrew
    [[ -s "$HOME/.pythonbrew/etc/bashrc" ]] && source "$HOME/.pythonbrew/etc/bashrc"
    # git completion
    #[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh
    #complete -W "$(echo $(grep '^ssh ' ~/.bash_history | sort -u | sed 's/^ssh //'))" ssh
    # ssh loop
    function sshl() 
    {
        timeout=10
        while [ 1 ] ; do 
            ssh "$@"
            read "Press any key to re-connect... or wait $timeout seconds to restart" -t $timeout foobar
        done
    }
    function git-export-diff() {
        if [ $# -ne 1 ] ; then
            echo "git-export-diff <version number>"
            return
        fi
        for i in `git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $1`
        do 
            mkdir -p `dirname "$1/$i"`
            echo "$1/$i"
            git show $1:$i > $1/$i
        done
    }
    function man () {
        /usr/bin/man $@ || (help $@ 2> /dev/null && help $@ | less)
    }
    # history
    export HISTCONTROL=erasedups
    export HISTTIMEFORMAT='%F %T '
    
    function tl() 
    {
        tree -C $* | less -R
    }
    
    # Compilation flags
    # export ARCHFLAGS="-arch x86_64"
    
    # ssh
    # export SSH_KEY_PATH="~/.ssh/dsa_id"
    
    ## pyenv
    #[[ -r "/usr/local/bin/virtualenvwrapper_lazy.sh" ]] && source "/usr/local/bin/virtualenvwrapper_lazy.sh"
    #[ -n "$VIRTUAL_ENV" ] && source "$VIRTUAL_ENV/bin/activate"
    #if type pyenv 2>&1 >/dev/null; then
    #    eval "$(pyenv init -)"
    #    export PATH="$HOME/.pyenv/bin:$PATH"
    #fi
    
    
    function exists { which $1 &> /dev/null }
    
    if exists percol; then
        function percol_select_history() {
            local tac
            exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
            BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
            CURSOR=$#BUFFER         # move cursor
            zle -R -c               # refresh
        }
    
        zle -N percol_select_history
        bindkey '^R' percol_select_history
    fi
    
    function ppgrep() {
        if [[ $1 == "" ]]; then
            PERCOL=percol
        else
            PERCOL="percol --query $1"
        fi
        ps aux | eval $PERCOL | awk '{ print $2 }'
    }
    
    function ppkill() {
        if [[ $1 =~ "^-" ]]; then
            QUERY=""            # options only
        else
            QUERY=$1            # with a query
            [[ $# > 0 ]] && shift
        fi
        ppgrep $QUERY | xargs kill $*
    }
    #source ~/.fzf.zsh
    
    #bindkey "^J" backward-char
    #bindkey "^H" backward-word #Notice!
    #bindkey "^K" forward-char
    #bindkey "^L" forward-word
    if [ -n "$VIRTUAL_ENV" ]; then
        if [ -z "$OLD_RPS1" ]; then
            OLD_RPS1=$RPS1
        fi
        RPS1="$(basename ${VIRTUAL_ENV} 2>/dev/null) $OLD_RPS1"
        export PATH="$VIRTUAL_ENV/bin:$PATH"
    fi
    
    if netstat -ntul | grep -q :3128; then
        export HTTP_PROXY=http://127.0.0.1:3128
        export http_proxy=$HTTP_PROXY
    fi
    
    function json() {
        # python -mjson.tool
        jq .
    }
    
    function xml() {
        xmllint --format -
    }
    
    mykill () {
        # ps h -o pid,command | grep "$@" | grep -v grep | sed 's/^ \+//' | cut -d ' ' -f 1 | xargs -n 1 kill -9
        ps h -o pid,command | grep "$@" | grep -v grep | sed 's/^ \+//' | cut -d ' ' -f 1 
    }
    
    
    # Instantly jump to your ag matches. https://github.com/aykamko/tag
    if (( $+commands[tag] )); then
        tag() { command tag "$@"; source ${TAG_ALIAS_FILE:-/tmp/tag_aliases} 2>/dev/null }
        alias ag=tag
    fi
    
    export QIP=127.0.0.1
    export QPORT=9000
    
    # Keypad
    # 0 . Enter
    bindkey -s "^[Op" "0"
    bindkey -s "^[Ol" "."
    bindkey -s "^[OM" "^M"
    # 1 2 3
    bindkey -s "^[Oq" "1"
    bindkey -s "^[Or" "2"
    bindkey -s "^[Os" "3"
    # 4 5 6
    bindkey -s "^[Ot" "4"
    bindkey -s "^[Ou" "5"
    bindkey -s "^[Ov" "6"
    # 7 8 9
    bindkey -s "^[Ow" "7"
    bindkey -s "^[Ox" "8"
    bindkey -s "^[Oy" "9"
    # + -  * /
    bindkey -s "^[Ok" "+"
    bindkey -s "^[Om" "-"
    bindkey -s "^[Oj" "*"
    bindkey -s "^[Oo" "/"
    
    
    # workaround for Home/End key from Xshell or Putty
    bindkey "\033[1~" beginning-of-line
    bindkey "\033[4~" end-of-line
    
    # Go environment
    # export GOROOT=$HOME/go
    export GOROOT=/usr/local/go
    export GOPATH=$HOME/workspace
    export GOBIN=$GOPATH/bin
    export PATH=$PATH:$GOROOT/bin:$GOBIN
    
    
    . /usr/share/autojump/autojump.sh
    
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    
    # https://github.com/denysdovhan/spaceship-zsh-theme
    # SPACESHIP_DOCKER_SHOW=false
    # SPACESHIP_NVM_SHOW_ON_PROJECT_ONLY=true
    # SPACESHIP_PROMPT_TRUNC=7
    
    # hh
    export HISTFILE=~/.zsh_history  # ensure history file visibility
    export HH_CONFIG=hicolor        # get more colors
    bindkey -s "\C-r" "\eqhh\n"     # bind hh to Ctrl-r (for Vi mode check doc)
    
    bug help-wanted 
    opened by linlinlinlin 45
  • Bad math expression

    Bad math expression

    Issue

    I get the following error

    spaceship_battery:37: bad math expression: operator expected at `47'
    

    Screenshot

    Provide a screenshot that show your issue

    screenshot

    Environment

    Operating system: Ubuntu 16.04 LTS Terminal emulator: Terminator ZSH version: zsh 5.1.1 (x86_64-ubuntu-linux-gnu)

    question 
    opened by clayrisser 33
  • Errors with prezto

    Errors with prezto

    Issue

    Hello,

    First of all thanks for making support for Prezto :)

    I've tried using Spaceship again since the support of prezto. However after following the instructions, and adding zstyle ':prezto:module:prompt' theme 'spaceship', I'm getting the following:

    Last login: Tue Feb  6 18:03:36 on ttys003
    prompt_spaceship_setup:source:99: no such file or directory: /Users/nicolaswidart/.yadr/zsh/prezto/modules/contrib-prompt/functions/lib/utils.zsh
    prompt_spaceship_setup:source:102: no such file or directory: /Users/nicolaswidart/.yadr/zsh/prezto/modules/contrib-prompt/functions/lib/hooks.zsh
    prompt_spaceship_setup:source:105: no such file or directory: /Users/nicolaswidart/.yadr/zsh/prezto/modules/contrib-prompt/functions/lib/section.zsh
    prompt_spaceship_setup:112: command not found: spaceship::union
    prompt_spaceship_setup:128: command not found: spaceship::deprecated
    prompt_spaceship_setup:129: command not found: spaceship::deprecated
    prompt_spaceship_setup:130: command not found: spaceship::deprecated
    prompt_spaceship_setup:131: command not found: spaceship::deprecated
    prompt_spaceship_setup:132: command not found: spaceship::deprecated
    zsh: spaceship_exec_time_precmd_hook: function definition file not found
    

    Screenshot

    Provide a screenshot that shows your issue

    image

    Environment

    Spaceship version: 3.0.1 (use echo $SPACESHIP_VERSION) Zsh version: Zsh framework: prezto Zsh plugin manager: none Terminal emulator: iTerm2 Operating system: macOS

    Relevant .zshrc

    #
    # Executes commands at the start of an interactive session.
    #
    # Authors:
    #   Sorin Ionescu <[email protected]>
    #
    
    # Source Prezto.
    if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
      source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
    fi
    
    # Customize to your needs...
    for config_file ($HOME/.yadr/zsh/*.zsh) source $config_file
    
    export PATH="$HOME/.yarn/bin:$PATH"
    eval "$(symfony-autocomplete)"
    
    if [ $commands[kubectl] ]; then
      source <(kubectl completion zsh)
    fi
    
    set +o noclobber
    #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
    export SDKMAN_DIR="/Users/nicolaswidart/.sdkman"
    [[ -s "/Users/nicolaswidart/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/nicolaswidart/.sdkman/bin/sdkman-init.sh"
    
    export PATH=/Users/nicolaswidart/.local/bin/luna-studio:$PATH
    
    

    Thanks

    opened by nWidart 25
  • Bar theme

    Bar theme

    Hello guys! Thank you for great work! You're awesome!

    Could you please help me to implement my zsh theme with spaceship?

    image

    My questions are:

    1. I already research the api and options and found no techniques to create background along the all line space. Am I right that I should create fully custom code like spaceship.zsh?

    2. As you see on the screen the bar going on the first line and it means that RPROMPT is not the solution. Also because if I want to copy the command and terminal output to someone I don't want to show the environment. It's custom again?

    3. Finally I print sections as "pills". I've tried to repeat it in spaceship as PREFIX but BG hasn't affected section text and affects only prefix text.

    4. I've tried to change SPACESHIP_CHAR_SYMBOL for arrow to classic $_LIBERTY (#/$) but no effect. Could you please give me an example.

    Please advise. It will be great if I could rebuild my theme from zsh-theme to spaceship-theme with many sections.

    Thanks!

    opened by anki-code 24
  • WIP: Async rendering

    WIP: Async rendering

    Changes

    • Implement async worker using mafredri/zsh-async https://github.com/mafredri/zsh-async
    • Implement async job for branch name, still not completed.

    TODO

    • Reuse the previous result when the directory is not changed.
    • Flush async jobs only on executing Git commands (including hub) and aliases.
    • Rerender the prompt.
    new-feature help-wanted breaking frozen async 
    opened by sei40kr 24
  • Fix battery_status with acpi

    Fix battery_status with acpi

    Description

    battery_data=$(acpi -b 2>/dev/null | head -1) battery_status="$( echo $battery_data | awk '{print tolower($3)}' )"

    echo $battery_status > charging,

    This leaves $battery_status to be charging, whereas it needs to be charging. Therefore, we need to strip the output

    Screenshot

    Current behavior

    After activating a conda environment, the arrow in the next line indicating the prompt disappears.

    Expected behavior

    After activating a conda environment, it's name should be displayed next to the working directory. In the next line, an arrow should indicate the prompt.

    Relevant Zsh configuration (.zshrc)

    # All default settings
    ZSH_THEME="spaceship"
    

    Environment

    Spaceship version: 3.5.0 Zsh version: 5.3 Zsh framework: oh-my-zsh Zsh plugin manager: None Terminal emulator: cygwin Operating system: Windows 10

    Screenshot

    Provide a screenshot that shows your issue.

    image

    Possible solution

    I guess some characters when determining the conda prefix are not escaped correctly. In particular \r could cause such problems.

    bug help-wanted windows 
    opened by sbmueller 21
  • Add Vagrant support

    Add Vagrant support

    Description

    This PR adds support to show Vagrant version and the symbol V.

    Currently, this is shown only in directories that have a Vagrantfile or the $VAGRANT_VAGRANTFILE file.

    Screenshot

    screenshot

    new-feature frozen 
    opened by guilhermeleobas 21
  • Command slow in repository

    Command slow in repository

    Current behavior

    1. cd to <repository_path>
    2. try to run git status 3x times
    3. When I finish type, it just show the first command result
    4. Cause in some repository only (Don't know, why)

    I validate that the main problem should cause by this theme, since I try to change the new ones, git status will return as expected.

    Expected behavior

    1. git status shouldn't take that long time.

    Relevant Zsh configuration (.zshrc)

    # Your configuration here
    
    p_url="https://github.com/denysdovhan/spaceship-prompt.git"
    spaceship_location="${HOME}/.zgen/sorin-ionescu/prezto-master/modules/prompt/external/spaceship"
    
    if ! is_folder_exist "$spaceship_location"; then
    	git clone "$spaceship_url" "$spaceship_location" &>/dev/null
    	ln -s "${spaceship_location}/spaceship.zsh-theme" ~/.zprezto/modules/prompt/functions/prompt_spaceship_setup
    fi
    
    if is_file_exist "${spaceship_location}/spaceship.zsh-theme"; then
    	prompt spaceship
    fi
    
    SPACESHIP_PROMPT_ORDER=(
    	time
    	user
    	host
    	package
    	node
    	ruby
    	xcode
    	swift
    	golang
    	php
    	docker
    	aws
    	conda
    	line_sep
    	dir
    	git
    	exec_time
    	line_sep
    	battery
    	exit_code
    	char
    )
    
    SPACESHIP_RPROMPT_ORDER=(
    	jobs
    )
    
    SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
    
    SPACESHIP_TIME_SHOW=true
    SPACESHIP_TIME_FORMAT="%D{%d-%m-%Y %H.%M.%S}"
    SPACESHIP_BATTERY_SHOW=always
    
    SPACESHIP_EXIT_CODE_SHOW=true
    SPACESHIP_EXEC_TIME_SHOW=true
    SPACESHIP_EXEC_TIME_ELAPSED=1
    

    you can get fully .zshrc at https://github.com/kamontat/myzs

    Environment

    Spaceship version: 3.5.0 (use echo $SPACESHIP_VERSION) Zsh version: zsh 5.5.1 (x86_64-apple-darwin17.5.0) Zsh framework: prezto Zsh plugin manager: zgen Terminal emulator: iTerm2 Operating system: macOS High Sierra 10.13.6

    Screenshot

    Provide a screenshot that shows your issue. This is Video upload in Google drive

    Google drive

    Possible solution

    I think, It start slow when I instal NVM but not sure.

    question async 
    opened by kamontat 20
  • Forcing the display of the user and hostname

    Forcing the display of the user and hostname

    This allows the user to set

    export SHOW_USER_HOSTNAME=true
    

    In its .zshrc configuration, which will force spaceship to display the username and host of the user logged in.

    Issue related: https://github.com/denysdovhan/spaceship-zsh-theme/issues/26

    new-feature help-wanted abandoned 
    opened by citosid 20
  • Fix Scala version detection

    Fix Scala version detection

    Fixed Scala version detection in scala.zsh section. Added "+" in regex. As it was before it was unable to detect versions of scala 2 from 2.10 up, for example currently newest 2.13.10

    opened by TAndronicus 1
  • Haxe support

    Haxe support

    The problem

    Haxe section is missing

    Describe the solution you'd like

    Version: haxe --version Icon: Detect files: "project.xml", "Project.xml", "application.xml", "haxelib.json", "hxformat.json", ".haxerc" Detect file extensions: "hx", "hxml"

    Describe alternatives you've considered

    No response

    Documentation and adoption

    No response

    help-wanted proposal good first issue 
    opened by denysdovhan 0
  • Prefixes in subsections are removed from rendering

    Prefixes in subsections are removed from rendering

    The problem

    I moved my custom section from v3 to v4. What my section does is similar to the hg section, but instead of showing the branch, it shows the commit name as I work in an environment with stacked diffs instead of branches, hence the first line of the commit is what is like my branch name. (hg branch returns default so I cannot use that, but that's besides the question.)

    This is what I'm expecting it to output when I have untracked changes:

    on ☿ COMMIT TITLE [?]
    

    But this is what it outputs:

    on ☿ COMMIT TITLE?]
    

    This seems to be due to calling spaceship::section::render on sections multiple times?

    This is the section that gets created in status_section from the code below:

    • (·|·red·|·[·|·]·|··|·?·|·).

    When that is passed to spaceship::section::render it outputs:

    • %{%B%}[%{%b%}%{%B%F{red}%}?%{%b%f%}%{%B%}]%{%b%}.

    At this point we still have the prefix. If we then pass it again to spaceship::section we get:

    • (·|··|··|··|··|·%{%B%}[%{%b%}%{%B%F{red}%}?%{%b%f%}%{%B%}]%{%b%}·|·)

    Finally if we pass that again to spaceship::section::render we get:

    • %{%B%F{}%}%{%B%}[%{%b%}%{%B%F{red}%}?%{%b%f%}%{%B%}]%{%b%}%{%b%f%}

    I'm not entirely sure whether it's misinterpreting it at the last or second to last step. But it seems to be going wrong in one of those because when returning the first section part, the prefix is still there.

    Relevant Zsh configuration

    This is hg_commit.zsh that I source and add as a section to my prompt:

    # ------------------------------------------------------------------------------
    # Configuration
    # ------------------------------------------------------------------------------
    
    SPACESHIP_HG_COMMIT_ASYNC="${SPACESHIP_HG_COMMIT_ASYNC=true}"
    SPACESHIP_HG_COMMIT_SHOW="${SPACESHIP_HG_COMMIT_SHOW=true}"
    SPACESHIP_HG_COMMIT_PREFIX="${SPACESHIP_HG_COMMIT_PREFIX="on "}"
    SPACESHIP_HG_COMMIT_SUFFIX="${SPACESHIP_HG_COMMIT_SUFFIX=" "}"
    SPACESHIP_HG_COMMIT_SYMBOL="${SPACESHIP_HG_COMMIT_SYMBOL="☿ "}"
    SPACESHIP_HG_COMMIT_COLOR="${SPACESHIP_HG_COMMIT_COLOR="magenta"}"
    
    SPACESHIP_HG_STATUS_SHOW="${SPACESHIP_HG_STATUS_SHOW=true}"
    SPACESHIP_HG_STATUS_PREFIX="${SPACESHIP_HG_STATUS_PREFIX=" ["}"
    SPACESHIP_HG_STATUS_SUFFIX="${SPACESHIP_HG_STATUS_SUFFIX="]"}"
    SPACESHIP_HG_STATUS_COLOR="${SPACESHIP_HG_STATUS_COLOR="red"}"
    SPACESHIP_HG_STATUS_UNTRACKED="${SPACESHIP_HG_STATUS_UNTRACKED="?"}"
    SPACESHIP_HG_STATUS_ADDED="${SPACESHIP_HG_STATUS_ADDED="+"}"
    SPACESHIP_HG_STATUS_MODIFIED="${SPACESHIP_HG_STATUD_MODIFIED="!"}"
    SPACESHIP_HG_STATUS_DELETED="${SPACESHIP_HG_STATUS_DELETED="✘"}"
    
    # ------------------------------------------------------------------------------
    # Section
    # ------------------------------------------------------------------------------
    
    
    commit_title() {
        local curr_hash="$(hg whereami)"
        if [ "$curr_hash" != "$__HG_CACHED_HASH" ]
        then
            local log_output=$(hg log -r . -T '{node} {desc|firstline}\n')
            if [ -n "$log_output" ]
            then
                __HG_CACHED_HASH="${log_output%% *}"
                __HG_CACHED_TITLE="${log_output#${__HG_CACHED_HASH} }"
            fi
        fi
        echo "$__HG_CACHED_TITLE"
    }
    
    
    spaceship_hg_commit() {
        [[ $SPACESHIP_HG_COMMIT_SHOW == false ]] && return
    
        spaceship::is_hg || return
    
        local 'hg_info'
    
        if ! hg_info=$(hg log -l1 | sed "4q;d" | cut -d' ' -f 2- | awk '{$1=$1};1' | awk -v len=60 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }'); then
            # Failed, show no section.
            return
        fi
    
        if [[ -z $hg_info ]]; then
            return
        fi
    
        local prefix_section=$(spaceship::section --color white $SPACESHIP_HG_COMMIT_PREFIX)
        local commit_section=$(spaceship::section --color $SPACESHIP_HG_COMMIT_COLOR --symbol $SPACESHIP_HG_COMMIT_SYMBOL $hg_info)
    
        local INDEX=$(hg status 2>/dev/null)
        local hg_status=""
    
        # Indicators are suffixed instead of prefixed to each other to
        # provide uniform view across git and mercurial indicators
        if $(echo "$INDEX" | grep -E '^\? ' &> /dev/null); then
            hg_status="$SPACESHIP_HG_STATUS_UNTRACKED$hg_status"
        fi
        if $(echo "$INDEX" | grep -E '^A ' &> /dev/null); then
            hg_status="$SPACESHIP_HG_STATUS_ADDED$hg_status"
        fi
        if $(echo "$INDEX" | grep -E '^M ' &> /dev/null); then
            hg_status="$SPACESHIP_HG_STATUS_MODIFIED$hg_status"
        fi
        if $(echo "$INDEX" | grep -E '^(R|!)' &> /dev/null); then
            hg_status="$SPACESHIP_HG_STATUS_DELETED$hg_status"
        fi
    
        local status_section=" "
    
        if [[ -n $hg_status ]]; then
            status_section="$(spaceship::section --color $SPACESHIP_HG_STATUS_COLOR --prefix $SPACESHIP_HG_STATUS_PREFIX --suffix $SPACESHIP_HG_STATUS_SUFFIX $hg_status)"
        fi
    
        spaceship::section \
            "$(spaceship::section::render $prefix_section)$(spaceship::section::render $commit_section)$(spaceship::section::render $status_section)"
    }
    

    You can replace the last section command with:

    spaceship::section \
            "$(spaceship::section::render $status_section)"
    

    If you want to focus on the prefix problem addressed here.

    What is version of Spaceship are you using?

    4.10.1

    What is version of Zsh are you using?

    zsh 5.7.1

    What operation system are you running?

    Linux

    Do you use any Zsh framework or plugin manager?

    oh-my-zsh

    Which terminal emulator do you use?

    kitty / VS Code Integrated Terminal

    Additional information

    You can find my dotfiles here: https://github.com/AndreasBackx/dotfiles.

    Also additional question: I tried to convert this to something similar to what the latest hg section looks like, but I cannot seem to use spaceship::precompile due to it not being initialised yet. Is there a way for custom sections to use these APIs? I thought it would be more ideal to change this code to use subsections, but I cannot find much documentation on that besides a reference to the hg and docker sections at the bottom of this page: https://spaceship-prompt.sh/api/section/.

    question 
    opened by AndreasBackx 3
  • mc subshell not working

    mc subshell not working

    The problem

    Recently I've decided to try something new for my zsh and I decided to go with spaceship. Yet after installing it mc subshell stopped working. Basically when I press ctrl+o in mc a black screen appears but I cannot type anything as it brings back mc. After commenting out spaceship from my .zshrc mc subshell starts working again.

    Relevant Zsh configuration

    # Set up the prompt
    autoload -Uz promptinit
    promptinit
    prompt adam1
    
    setopt histexpiredupsfirst histignorealldups histignoredups histignorespace histverify incappendhistory sharehistory
    
    # Use emacs keybindings even if our EDITOR is set to vi
    bindkey -e
    
    # Enable zinit
    declare -A ZINIT
    ZINIT[PLUGINS_DIR]="/tmp/zinit_plugs"
    source "/usr/local/share/zinit/zinit.zsh"
    
    # Enable spaceship prompt
    zinit snippet OMZP::sudo
    zinit light spaceship-prompt/spaceship-prompt
    

    What is version of Spaceship are you using?

    v4.10.1

    What is version of Zsh are you using?

    5.9

    What operation system are you running?

    Linux (debian unstalbe)

    Do you use any Zsh framework or plugin manager?

    zinit

    Which terminal emulator do you use?

    putty

    Additional information

    No response

    bug 
    opened by skibbipl 0
  • `ansible` section detects wrong yaml file

    `ansible` section detects wrong yaml file

    The problem

    I have a Taskfile YAML file in my projects and ansible section interprets it as an ansible file since it detects a tasks key in the file and therefore assumes it is a playbook.

    Example

    version: '3'
    
    tasks:
      hello:
        cmds:
          - echo 'Hello World from Task!'
        silent: true
    

    Relevant Zsh configuration

    No response

    What is version of Spaceship are you using?

    v4.10.0

    What is version of Zsh are you using?

    5.9

    What operation system are you running?

    macOS 12.6

    Do you use any Zsh framework or plugin manager?

    None

    Which terminal emulator do you use?

    tmux

    Additional information

    No response

    bug 
    opened by merikan 4
  • It works only for first time

    It works only for first time

    The problem

    It works for me only the first time after installation. If I open a new tab in the terminal or run another one - I'll have forever "..." instead of prompt. Working tabs display folder name (zsh), while the not working - folder name (bat).

    Relevant Zsh configuration

    source "/opt/homebrew/opt/spaceship/spaceship.zsh"
    

    What is version of Spaceship are you using?

    4.9.1

    What is version of Zsh are you using?

    5.8.1 (x86_64-apple-darwin22.0)

    What operation system are you running?

    macOS

    Do you use any Zsh framework or plugin manager?

    oh-my-zsh

    Which terminal emulator do you use?

    iTerm

    Additional information

    No response

    question 
    opened by M1crogravity 9
Releases(v4.12.0)
Owner
Spaceship
Spaceship is a minimalistic, powerful and extremely customizable Zsh prompt
Spaceship
A very opinionated, zero-configuration shell prompt

A very opinionated, zero-configuration shell prompt

amy null 8 Nov 4, 2021
Shellfirm - Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification

shellfirm Opppppsss you did it again? ?? ?? ?? Protect yourself from yourself! rm -rf * git reset --hard before saving? kubectl delete ns which going

elad 652 Dec 29, 2022
☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell

☄??️ The minimal, blazing-fast, and infinitely customizable prompt for any shell

Starship Command 31.6k Dec 30, 2022
A super simple prompt for Fish shell, just shows git info and Vi mode.

vifi is a portmandeau of 'Vi' and 'Fish', because it's a prompt for Fish shell, primarily focused around showing proper indicators when using Vi key bindings.

Mat Jones 1 Sep 15, 2022
Prompt Description Language [POC]

Prompt Description Language (V0.1.1 POC) Description PDL (Prompt Description Language) format provides an extensible way to describe the behavior and

Alex 192 Jun 5, 2023
Solving context limits when working with AI LLM models by implementing a "chunkable" attribute on your prompt structs.

Promptize Promptize attempts to solve the issues with context limits when working with AI systems. It allows a user to add an attribute to their struc

Dan Nelson 5 Jul 18, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
zsh modules written in rust

zsh-module-poc Can you make a module for zsh written in Rust? Yes, yes you can and this is a proof of concept. It's a start but I have no idea how to

Michael Gattozzi 41 Apr 11, 2022
A zsh histb browser using skim. Implemented in rust.

A zsh histb browser using skim. Implemented in rust.

Matthias Bilger 18 Nov 17, 2022
A very opinionated, zero-configuration shell prompt

A very opinionated, zero-configuration shell prompt

amy null 8 Nov 4, 2021
Shellfirm - Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification

shellfirm Opppppsss you did it again? ?? ?? ?? Protect yourself from yourself! rm -rf * git reset --hard before saving? kubectl delete ns which going

elad 652 Dec 29, 2022
☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell

☄??️ The minimal, blazing-fast, and infinitely customizable prompt for any shell

Starship Command 31.6k Dec 30, 2022
A super simple prompt for Fish shell, just shows git info and Vi mode.

vifi is a portmandeau of 'Vi' and 'Fish', because it's a prompt for Fish shell, primarily focused around showing proper indicators when using Vi key bindings.

Mat Jones 1 Sep 15, 2022
Prompt Description Language [POC]

Prompt Description Language (V0.1.1 POC) Description PDL (Prompt Description Language) format provides an extensible way to describe the behavior and

Alex 192 Jun 5, 2023
Solving context limits when working with AI LLM models by implementing a "chunkable" attribute on your prompt structs.

Promptize Promptize attempts to solve the issues with context limits when working with AI systems. It allows a user to add an attribute to their struc

Dan Nelson 5 Jul 18, 2023