| Crates.io | zsh-git-prompt-rs |
| lib.rs | zsh-git-prompt-rs |
| version | 1.0.3 |
| created_at | 2024-12-18 06:00:45.466604+00 |
| updated_at | 2026-01-18 14:08:59.679815+00 |
| description | A git status prompt for zsh written in Rust |
| homepage | |
| repository | https://github.com/navicore/zsh-git-prompt-rs |
| max_upload_size | |
| id | 1487240 |
| size | 30,877 |
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.
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
#