#git-prompt #zsh #git

app zsh-git-prompt-rs

A git status prompt for zsh written in Rust

6 releases (2 stable)

Uses new Rust 2024

1.0.3 Jan 18, 2026
1.0.0 May 25, 2025
0.3.5 Dec 21, 2024
0.1.0 Dec 18, 2024

#679 in Development tools

MIT license

26KB
587 lines

Dependabot Updates rust-clippy analyze Publish-Crate

zsh prompt originally implemented by https://github.com/olivierverdier/zsh-git-prompt

I no longer install the Haskell toolchain everywhere so am trying to implement that prompt in Rust.

Installation

Install zsh-git-prompt-rs via cargo:

cargo install zsh-git-prompt-rs

The prompt supports optional Nerd Font icons for the branch symbol and stash indicator. If you have a Nerd Font installed, you can enable them by setting ZSH_THEME_GIT_PROMPT_BRANCH_SYMBOL and ZSH_THEME_GIT_PROMPT_STASH as shown in the example below.

In your zsh init

#
# BEGIN PROMPT
#

# enable prompt

if command -v gitstatus >/dev/null 2>&1; then
  source <(gitstatus --script)
fi

# customize prompt

PROMPT_PRE=''
if [[ $SESSION_TYPE == 'remote/ssh' ]]; then
  PROMPT_PRE='%n@%m '
fi

PROMPT='${PROMPT_PRE}%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg[green]%}%p %{$fg[green]%}%c %{$reset_color%}$(git_super_status)%{$fg_bold[red]%}% %{$reset_color%}'

# Git prompt customization
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_SEPARATOR=""
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_BRANCH_SYMBOL="%{$fg_bold[cyan]%}%{%G%}"  # nerd font branch icon
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[blue]%}%{ ●%G%}"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{ ✖%G%}"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[yellow]%}%{ ✚%G%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{ ↓%G%}"
ZSH_THEME_GIT_PROMPT_AHEAD="%{ ↑%G%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}%{ …%G%}"
ZSH_THEME_GIT_PROMPT_STASH="%{$fg[yellow]%}%{ 󰏗%G%}"  # nerd font stash icon
ZSH_THEME_GIT_PROMPT_CLEAN=""

#
# END PROMPT
#

Dependencies

~1MB
~16K SLoC