Options.md

August 21, 2019 · View on GitHub

Options

You have ability to customize or disable specific elements of Spacefish. All options must be overridden in your config.fish.

Colors for sections can be basic colors or color codes.

Note: the symbol · in this document represents a regular space character , it is used to clearly indicate when an option default value starts or ends with a space.

Order

You can specify the order of prompt section using SPACEFISH_PROMPT_ORDER option. Use Zsh array syntax to define your own prompt order.

The order also defines which sections that Spacefish loads. If you're struggling with slow prompt, you can just omit the sections that you don't use, and they won't be loaded.

The default order is:

    set SPACEFISH_PROMPT_ORDER time user dir host git package node docker ruby golang php rust haskell julia aws conda pyenv kubecontext exec_time line_sep battery jobs exit_code char

You can also add items to the right prompt by specifying them in the SPACEFISH_RPROMPT_ORDER option. By default SPACEFISH_RPROMPT_ORDER is empty.

Prompt

This group of options defines a behavior of prompt and standard parameters for sections displaying.

VariableDefaultMeaning
SPACEFISH_PROMPT_ADD_NEWLINEtrueAdds a newline character before each prompt line
SPACEFISH_PROMPT_SEPARATE_LINEtrueMake the prompt span across two lines
SPACEFISH_PROMPT_FIRST_PREFIX_SHOWfalseShows a prefix of the first section in prompt
SPACEFISH_PROMPT_PREFIXES_SHOWtrueShow prefixes before prompt sections
SPACEFISH_PROMPT_SUFFIXES_SHOWtrueShow suffixes before prompt sections
SPACEFISH_PROMPT_DEFAULT_PREFIXviaDefault prefix for prompt sections
SPACEFISH_PROMPT_DEFAULT_SUFFIX Default suffix for prompt section

Time (time)

VariableDefaultMeaning
SPACEFISH_TIME_SHOWfalseShow current time
SPACEFISH_DATE_SHOWfalse·Show today's date
SPACEFISH_TIME_PREFIXat·Prefix before time section
SPACEFISH_TIME_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after time section
SPACEFISH_TIME_FORMATfalseCustom time/date formatting, set as a string to enable (man date for help)
SPACEFISH_TIME_12HRfalseUse 12 hour clock AM/PM
SPACEFISH_TIME_COLORyellowColor of time section

Username (user)

By default, a username is shown only when it's not the same as $LOGNAME, when you're connected via SSH or when you're root. Root user is highlighted in SPACEFISH_USER_COLOR_ROOT color (red as default).

VariableDefaultMeaning
SPACEFISH_USER_SHOWtrueShow user section (true, false, always or needed)
SPACEFISH_USER_PREFIXwith·Prefix before user section
SPACEFISH_USER_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after user section
SPACEFISH_USER_COLORyellowColor of user section
SPACEFISH_USER_COLOR_ROOTredColor of user section when it's root

SPACEFISH_USER_SHOW defines when to show username section. Here are possible values:

SPACEFISH_USER_SHOWShow on localShow on remote
falseNeverNever
alwaysAlwaysAlways
trueIf neededAlways
neededIf neededIf needed

Directory (dir)

Directory is always shown and truncated to the value of SPACEFISH_DIR_TRUNC. While you are in a Git repository, this section shows only the project title and relevant status icons. If current directory is write-protected or if current user doesn't have write permissions, a padlock (by default) will be displayed as a suffix.

VariableDefaultMeaning
SPACEFISH_DIR_SHOWtrueShow directory section
SPACEFISH_DIR_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after current directory
SPACEFISH_DIR_TRUNC3Number of folders of cwd to show in prompt, 0 to show all
SPACEFISH_DIR_TRUNC_REPOtrueWhile in git repo, show only root directory and folders inside it
SPACEFISH_DIR_COLORcyanColor of directory section
SPACEFISH_DIR_PREFIXin·Prefix before current directory
SPACEFISH_DIR_LOCK_SHOWtrueShow directory write-protected symbol
SPACEFISH_DIR_LOCK_SYMBOL·🔒The symbol displayed if directory is write-protected (requires powerline patched font)
SPACEFISH_DIR_LOCK_COLORredColor for the lock symbol

Hostname (host)

Hostname should only be shown while you are connected to another machine using SSH, unless you change it using SPACEFISH_HOST_SHOW.

VariableDefaultMeaning
SPACEFISH_HOST_SHOWtrueShow host section (true, false, always)
SPACEFISH_HOST_SHOW_FULLfalseShow full hostname section (true, false)
SPACEFISH_HOST_PREFIXat·Prefix before the hostname
SPACEFISH_HOST_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the hostname
SPACEFISH_HOST_COLORblueColor of the hostname
SPACEFISH_HOST_COLOR_SSHgreenColor of the hostname during SSH

Git (git)

Git section is consists with git_branch and git_status subsections. It is shown only in Git repositories.

VariableDefaultMeaning
SPACEFISH_GIT_SHOWtrueShow Git section
SPACEFISH_GIT_PREFIXon·Prefix before Git section
SPACEFISH_GIT_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Git section
SPACEFISH_GIT_SYMBOL·Character to be shown before Git section (requires powerline patched font

Git branch (git_branch)

VariableDefaultMeaning
SPACEFISH_GIT_BRANCH_SHOWtrueShow Git branch subsection
SPACEFISH_GIT_BRANCH_PREFIX$SPACEFISH_GIT_SYMBOLPrefix before Git branch subsection
SPACEFISH_GIT_BRANCH_SUFFIX Suffix after Git branch subsection
SPACEFISH_GIT_BRANCH_COLOR(set_color magenta)Color of Git branch subsection

Git status (git_status)

Git status indicators is shown only when you have dirty repository.

VariableDefaultMeaning
SPACEFISH_GIT_STATUS_SHOWtrueShow Git status subsection
SPACEFISH_GIT_STATUS_PREFIX·[Prefix before Git status subsection
SPACEFISH_GIT_STATUS_SUFFIX]Suffix after Git status subsection
SPACEFISH_GIT_STATUS_COLORredColor of Git status subsection
SPACEFISH_GIT_STATUS_UNTRACKED?Indicator for untracked changes
SPACEFISH_GIT_STATUS_ADDED+Indicator for added changes
SPACEFISH_GIT_STATUS_MODIFIED!Indicator for unstaged files
SPACEFISH_GIT_STATUS_RENAMED»Indicator for renamed files
SPACEFISH_GIT_STATUS_DELETEDIndicator for deleted files
SPACEFISH_GIT_STATUS_STASHED$Indicator for stashed changes
SPACEFISH_GIT_STATUS_UNMERGED=Indicator for unmerged changes
SPACEFISH_GIT_STATUS_AHEADIndicator for unpushed changes (ahead of remote branch)
SPACEFISH_GIT_STATUS_BEHINDIndicator for unpulled changes (behind of remote branch)
SPACEFISH_GIT_STATUS_DIVERGEDIndicator for diverged chages (diverged with remote branch)

Package version (package)

Works only for npm and cargo at the moment. Please, help spaceship improve this section!

Package version is shown when repository is a package (e.g. contains a package.json or Cargo.toml file). If no version information is found in package.json or there is an error parsing Cargo.toml, the symbol will be shown.

  • npmnpm package contains a package.json file. We use jq, python to parse package version for improving performance and node as a fallback. Install jq for improved performance of this section (Why?)
  • cargocargo package contains a Cargo.toml file. Currently, we use cargo pkgid, it depends on Cargo.lock. So if package version isn't shown, you may need to run some command like cargo build which can generate Cargo.lock file.

Note: This is the version of the package you are working on, not the version of package manager itself.

VariableDefaultMeaning
SPACEFISH_PACKAGE_SHOWtrueShow package version
SPACEFISH_PACKAGE_PREFIXis·Prefix before package version section
SPACEFISH_PACKAGE_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after package version section
SPACEFISH_PACKAGE_SYMBOL📦·Character to be shown before package version
SPACEFISH_PACKAGE_COLORredColor of package version section

Node.js (node)

Node.js section is shown only in directories that contain package.json file, or node_modules folder, or any other file with .js extension.

If you set SPACEFISH_NODE_DEFAULT_VERSION to the default Node.js version and your current version is the same as SPACEFISH_NODE_DEFAULT_VERSION, then Node.js section will be hidden.

VariableDefaultMeaning
SPACEFISH_NODE_SHOWtrueCurrent Node.js section
SPACEFISH_NODE_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before Node.js section
SPACEFISH_NODE_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Node.js section
SPACEFISH_NODE_SYMBOL⬢·Character to be shown before Node.js version
SPACEFISH_NODE_DEFAULT_VERSION Node.js version to be treated as default
SPACEFISH_NODE_COLORgreenColor of Node.js section

Julia (julia)

Julia section is shown only in directories that contain any file with .jl extension.

VariableDefaultMeaning
SPACEFISH_JULIA_SHOWtrueShow Julia section
SPACEFISH_JULIA_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before Julia section
SPACEFISH_JULIA_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Julia section
SPACEFISH_JULIA_SYMBOLஃ·Character to be shown before Julia version
SPACEFISH_JULIA_COLORgreenColor of Julia section

Docker (docker)

Docker section is shown only in directories that contain Dockerfile or docker-compose.yml and also if the $COMPOSE_FILE is set. The section will also appear when .dockerenv is in the root directory, signifying that you're in a container.

VariableDefaultMeaning
SPACEFISH_DOCKER_SHOWtrueShow current Docker version
SPACEFISH_DOCKER_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the Docker section
SPACEFISH_DOCKER_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the Docker section
SPACEFISH_DOCKER_SYMBOL🐳·Character to be shown before Docker version
SPACEFISH_DOCKER_COLORcyanColor of Docker section
SPACEFISH_DOCKER_VERBOSE_VERSIONfalseShow full version name. (Beta, Nightly)

Ruby (ruby)

Ruby section is shown only in directories that contain Gemfile, or Rakefile, or any other file with .rb extension.

VariableDefaultMeaning
SPACEFISH_RUBY_SHOWtrueShow Ruby section
SPACEFISH_RUBY_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before Ruby section
SPACEFISH_RUBY_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Ruby section
SPACEFISH_RUBY_SYMBOL💎·Character to be shown before Ruby version
SPACEFISH_RUBY_COLORredColor of Ruby section

Haskell (haskell)

Haskell section is shown only in directories that contain stack.yaml.

VariableDefaultMeaning
SPACEFISH_HASKELL_SHOWtrueShow Haskell section
SPACEFISH_HASKELL_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before Haskell section
SPACEFISH_HASKELL_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Haskell section
SPACEFISH_HASKELL_SYMBOLλ·Character to be shown before Haskell version
SPACEFISH_HASKELL_COLORredColor of Haskell section

Amazon Web Services (AWS) (aws)

Shows selected Amazon Web Services profile configured using AWS_VAULT or AWS_PROFILE variable.

VariableDefaultMeaning
SPACEFISH_AWS_SHOWtrueShow current selected AWS-cli profile or not
SPACEFISH_AWS_PREFIXusing·Prefix before the AWS section
SPACEFISH_AWS_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the AWS section
SPACEFISH_AWS_SYMBOL☁️·Character to be shown before AWS profile
SPACEFISH_AWS_COLORff8700Color of AWS section

Virtualenv (venv)

Python virtual environment when $VIRTUAL_ENV is set.

VariableDefaultMeaning
SPACEFISH_VENV_SHOWtrueShow current Python virtualenv or not
SPACEFISH_VENV_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the virtualenv section
SPACEFISH_VENV_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the virtualenv section
SPACEFISH_VENV_SYMBOL·Character to be shown before virtualenv
SPACEFISH_VENV_GENERIC_NAMESvirtualenv venv .venvIf the virtualenv folder is in this array, than use its parent directory as its name instead
SPACEFISH_VENV_COLORblueColor of virtualenv environment section

Conda (conda)

Conda section is shown when conda is installed and $CONDA_DEFAULT_ENV is set.

VariableDefaultMeaning
SPACEFISH_CONDA_SHOWtrueShow current Conda version
SPACEFISH_CONDA_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the conda section
SPACEFISH_CONDA_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the conda section
SPACEFISH_CONDA_SYMBOL🅒·Character to be shown before Conda version
SPACEFISH_CONDA_COLORblueColor of Conda section

Elixir (elixir)

Elixir section is shown when mix.exs is found or elixir files are found and either kiex, exenv, elixir is avaiable on your path.

VariableDefaultMeaning
SPACEFISH_ELIXIR_SHOWtrueShow current Elixir version
SPACEFISH_ELIXIR_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the elixir section
SPACEFISH_ELIXIR_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the elixir section
SPACEFISH_ELIXIR_SYMBOL💧·Character to be shown before Elixir version
SPACEFISH_ELIXIR_COLORmagentaColor of Elixir section

Pyenv (pyenv)

Pyenv section is shown only in directories that contain .python-version, requirements.txt, pyproject.toml, or any other file with .py extension. The section will also be shown if the $PYENV_VERSION environment variable is set.

VariableDefaultMeaning
SPACEFISH_PYENV_SHOWtrueShow current Pyenv version
SPACEFISH_PYENV_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the pyenv section
SPACEFISH_PYENV_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the pyenv section
SPACEFISH_PYENV_SYMBOL🐍·Character to be shown before Pyenv version
SPACEFISH_PYENV_COLORyellowColor of Pyenv section

Go (golang)

Go section is shown only in directories that contain Godeps, glide.yaml, go.mod, any other file with .go extension, or when current directory is in the Go workspace defined in $GOPATH.

VariableDefaultMeaning
SPACEFISH_GOLANG_SHOWtrueShow current Go version
SPACEFISH_GOLANG_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the Go section
SPACEFISH_GOLANG_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the Go section
SPACEFISH_GOLANG_SYMBOL🐹·Character to be shown before Go version
SPACEFISH_GOLANG_COLORcyanColor of Go section

PHP (php)

PHP section is shown only in directories that contain composer.json file, or any other file with .php extension.

VariableDefaultMeaning
SPACEFISH_PHP_SHOWtrueShow PHP section
SPACEFISH_PHP_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the PHP section
SPACEFISH_PHP_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the PHP section
SPACEFISH_PHP_SYMBOL🐘·Character to be shown before PHP version
SPACEFISH_PHP_COLORblueColor of PHP section

Rust (rust)

Rust section is shown only in directories that contain Cargo.toml or any other file with .rs extension.

VariableDefaultMeaning
SPACEFISH_RUST_SHOWtrueShow current Rust version
SPACEFISH_RUST_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before the Rust section
SPACEFISH_RUST_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the Rust section
SPACEFISH_RUST_SYMBOL𝗥·Character to be shown before Rust version
SPACEFISH_RUST_COLORredColor of Rust section
SPACEFISH_RUST_VERBOSE_VERSIONfalseShow what branch is being used, if any. (Beta, Nightly)

.NET (dotnet)

.NET section is shown only in directories that contains a project.json, global.json or paket.dependencies file, or a file with one of these extensions: .csproj, .xproj, .fproj or .sln.

VariableDefaultMeaning
SPACEFISH_DOTNET_SHOWtrueCurrent .NET section
SPACEFISH_DOTNET_PREFIX$SPACEFISH_PROMPT_DEFAULT_PREFIXPrefix before .NET section
SPACEFISH_DOTNET_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after .NET section
SPACEFISH_DOTNET_SYMBOL.NET·Character to be shown before .NET version
SPACEFISH_DOTNET_COLOR128Color of .NET section

Kubectl context (kubecontext)

Kubernetes context is shown everywhere if kubectl binary is found.

VariableDefaultMeaning
SPACEFISH_KUBECONTEXT_SHOWtrueShow current kubectl context
SPACEFISH_KUBECONTEXT_NAMESPACE_SHOWtrueShow current kubectl context namespace
SPACEFISH_KUBECONTEXT_PREFIXat Prefix before the kubectl section
SPACEFISH_KUBECONTEXT_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after the kubectl section
SPACEFISH_KUBECONTEXT_SYMBOL☸️ Character to be shown before kubectl context
SPACEFISH_KUBECONTEXT_COLORcyanColor of kubectl section

Exec Time (exec_time)

Execution time of the last command. Will be displayed if it exceeds the set threshold of time.

VariableDefaultMeaning
SPACEFISH_EXEC_TIME_SHOWtrueShow execution time
SPACEFISH_EXEC_TIME_PREFIXtook·Prefix before exec time section
SPACEFISH_EXEC_TIME_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after exec time section
SPACEFISH_EXEC_TIME_COLORyellowColor of exec time section
SPACEFISH_EXEC_TIME_ELAPSED5The threshold in seconds for showing exec time section

Line Separator (line_sep)

This is where the prompt will split into two lines, if enabled.

Battery (battery)

By default, Battery section is shown only if battery level is below SPACEFISH_BATTERY_THRESHOLD (default: 10%).

VariableDefaultMeaning
SPACEFISH_BATTERY_SHOWtrueShow battery section (true, false, always or charged)
SPACEFISH_BATTERY_PREFIX Prefix before battery section
SPACEFISH_BATTERY_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after battery section
SPACEFISH_BATTERY_SYMBOL_CHARGINGCharacter to be shown if battery is charging
SPACEFISH_BATTERY_SYMBOL_DISCHARGINGCharacter to be shown if battery is discharging
SPACEFISH_BATTERY_SYMBOL_FULLCharacter to be shown if battery is full
SPACEFISH_BATTERY_THRESHOLD10Battery level below which battery section will be shown

SPACEFISH_BATTERY_SHOW defines when to show battery section. Here are possible values:

SPACEFISH_BATTERY_SHOWBelow thresholdAbove thresholdFully charged
falseHiddenHiddenHidden
alwaysShownShownShown
trueShownHiddenHidden
chargedShownHiddenShown

Vi-mode ( vi_mode )

This section shows mode indicator only when Vi-mode is enabled.

VariableDefaultMeaning
SPACEFISH_VI_MODE_SHOWtrueShown current Vi-mode or not
SPACEFISH_VI_MODE_PREFIX Prefix before Vi-mode section
SPACEFISH_VI_MODE_SUFFIX$SPACEFISH_PROMPT_DEFAULT_SUFFIXSuffix after Vi-mode section
SPACEFISH_VI_MODE_INSERT[I]Text to be shown when in insert mode
SPACEFISH_VI_MODE_NORMAL[N]Text to be shown when in normal mode
SPACEFISH_VI_MODE_VISUAL[V]Text to be shown when in visual mode
SPACEFISH_VI_MODE_REPLACE_ONE[R]Text to be shown when in replace_one mode
SPACEFISH_VI_MODE_COLORwhiteColor of Vi-mode section

Jobs (jobs)

This section only shows when there are backgrounded jobs.

VariableDefaultMeaning
SPACEFISH_JOBS_SHOWtrueShow background jobs indicator
SPACEFISH_JOBS_PREFIX Prefix before the jobs indicator
SPACEFISH_JOBS_SUFFIX Suffix after the jobs indicator
SPACEFISH_JOBS_SYMBOLCharacter to be shown when jobs are hiding
SPACEFISH_JOBS_COLORblueColor of background jobs section
SPACEFISH_JOBS_AMOUNT_PREFIX Prefix before the number of jobs
SPACEFISH_JOBS_AMOUNT_SUFFIX Suffix after the number of jobs
SPACEFISH_JOBS_AMOUNT_THRESHOLD1Number of jobs after which job count will be shown

Exit Code (exit_code)

Disabled by default. Set SPACEFISH_EXIT_CODE_SHOW to true to enable.

VariableDefaultMeaning
SPACEFISH_EXIT_CODE_SHOWfalseShow the exit code of the previous command
SPACEFISH_EXIT_CODE_PREFIX Prefix of exit code
SPACEFISH_EXIT_CODE_SUFFIX Suffix of exit code
SPACEFISH_EXIT_CODE_SYMBOLSymbol before the exit code, upon failure
SPACEFISH_EXIT_CODE_COLORredColor of exit code section

Char (char)

VariableDefaultMeaning
SPACEFISH_CHAR_PREFIX Prefix before prompt character
SPACEFISH_CHAR_SUFFIX Suffix after prompt character
SPACEFISH_CHAR_SYMBOLPrompt character to be shown before any command
SPACEFISH_CHAR_COLOR_SUCCESSgreenColor of prompt character if last command completes successfully
SPACEFISH_CHAR_COLOR_FAILUREredColor of prompt character if last command returns non-zero exit-code