ZSH
prompt for Astronauts.
Spacezsh is an async prompt tries to do things right in the ZSH way. It introduces a lot of ZSH goodies including:
- Conditional async on each section/segment with tag
section::async
- 100%
promptinit
compliant. autoload
all of the functions.- Speed the prompt up with ZSH built-in utilities
- Env var
$EPOCHREALTIME
replaces external commanddate
inexec_time
section; - ZSH module
jobstates
replaces external commandjobs
injobs
section; - Section
vcs
based on ZSH utilityvcs_info
replaces sectiongit
andhg
. It also adds support for SVN; - Complete vi mode with more type of hooks being used for a better detection of mode changes.
- Trigger prompt redrawing on hook
chpwd
where hookprecmd
is not triggered;
- Env var
- For more changes, new features, new sections brought by Spacezsh, check the CHANGELOG for detail.
Visit Troubleshooting for instructions to recreate this terminal setup.
- Clever hostname and username displaying.
- Prompt character turns red if the last command exits with non-zero code.
- (New) Prompt character changes with vi modes.
- (New) Current branch and status support for Git, Mercurial, SVN:
?
โ untracked changes;โ
โ unstaged changes;โ
โ staged/uncommitted changes in the index;$
โ stashed changes;โก
โ ahead of remote branch;โฃ
โ behind of remote branch;- The following states are supported but disable by default:
ยป
โ renamed files;โ
โ deleted files;=
โ unmerged changes;- changeset/commit id;
- 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 (
เฎ
). - (New) Currnet Vagrant machine status (
๏ผถ
) - 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 .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.
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. Or use Nerd Font.
Use this command in your .zshrc
to load Spacezsh:
# Optional: compile source files into bytecode to speed up init
# zinit ice pick'spacezsh.zsh' \
# compile'{presets/^(*.zwc),lib/**/^(*.zwc),sections/^(*.zwc)}'
zinit light laggardkernel/spacezsh-prompt
TODO
Clone this repo:
git clone https://github.com/laggardkernel/spacezsh-prompt.git "$ZSH_CUSTOM/themes/spacezsh-prompt" --depth=1
Symlink spacezsh.zsh-theme
to your oh-my-zsh custom themes directory:
ln -s "$ZSH_CUSTOM/themes/spacezsh-prompt/spacezsh.zsh-theme" "$ZSH_CUSTOM/themes/spacezsh.zsh-theme"
Set ZSH_THEME="spacezsh"
in your .zshrc
.
Spacezsh 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)
Having trouble? Take a look at out Troubleshooting page.
Still struggling? Please, file an issue, describe your problem and we will gladly help you.
- spaceship-prompt/spaceship-prompt.
- Conditional async per segment ported from dritter's implementaion.
- mafredri/zsh-async, an asynchronous library.
- robobenklein/zinc, neat prompt framework where the neat framework and custom hook system are borrowed.
- Powerlevel9k/powerlevel9k, used as a reference for section optimization.
MIT ยฉ laggardkernel