Recipes

The following are based on popular Git-aware prompts. These have not been thoroughly battle tested — they are not "supported official Git Prompt Kit themes" but rather starting points for those new to customizing the zsh prompt.

TIP

For a pre-made, polished, Git Prompt Kit-powered zsh prompt, check out Hometown.

TIP

In the examples below, the construct ${x:+y} is "print $y if $x is not null". In the context of prompt building, this is useful for conditionally adding spaces: ${x:+$x } is "print $x if $x is not null".

git-radar-like

# ~/.zshrc
# --- snip ---
# Configure Git Prompt Kit
GIT_PROMPT_KIT_COLOR_ACTION=yellow
GIT_PROMPT_KIT_COLOR_ASSUME_UNCHANGED=yellow
GIT_PROMPT_KIT_COLOR_CWD=blue
GIT_PROMPT_KIT_COLOR_HEAD=green
GIT_PROMPT_KIT_COLOR_REMOTE=red
GIT_PROMPT_KIT_COLOR_SKIP_WORKTREE=yellow
GIT_PROMPT_KIT_COLOR_STAGED=green
GIT_PROMPT_KIT_COLOR_STASH=yellow
GIT_PROMPT_KIT_COLOR_UNSTAGED=red
GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT=0
GIT_PROMPT_KIT_GIT_STATUS_ON_OWN_LINE=0
GIT_PROMPT_KIT_REPO_SUBDIRECTORY_MAX_TRAILING_COUNT=0
GIT_PROMPT_KIT_SHOW_INACTIVE_STATUS=0
GIT_PROMPT_KIT_SYMBOL_CHAR_NORMAL="⮕ "
GIT_PROMPT_KIT_SYMBOL_STASH=≡

# Load Git Prompt Kit (will differ depending on installation method)

# Build prompt
PROMPT=
PROMPT+=$'\n'
PROMPT+='$GIT_PROMPT_KIT_CHAR '
PROMPT+='$GIT_PROMPT_KIT_CWD '
PROMPT+='${GIT_PROMPT_KIT_HEAD:+git:($GIT_PROMPT_KIT_HEAD}'
PROMPT+='${GIT_PROMPT_KIT_ACTION:+ $GIT_PROMPT_KIT_ACTION}'
PROMPT+='${GIT_PROMPT_KIT_BEHIND:+ $GIT_PROMPT_KIT_BEHIND}'
PROMPT+='${GIT_PROMPT_KIT_AHEAD:+ $GIT_PROMPT_KIT_AHEAD}'
PROMPT+='${GIT_PROMPT_KIT_REMOTE:+ $GIT_PROMPT_KIT_REMOTE}'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+) }'
PROMPT+='${GIT_PROMPT_KIT_DELETED_STAGED:+$GIT_PROMPT_KIT_DELETED_STAGED }'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED_STAGED:+$GIT_PROMPT_KIT_MODIFIED_STAGED }'
PROMPT+='${GIT_PROMPT_KIT_NEW:+$GIT_PROMPT_KIT_NEW }'
PROMPT+='${GIT_PROMPT_KIT_DELETED:+$GIT_PROMPT_KIT_DELETED }'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED:+$GIT_PROMPT_KIT_MODIFIED }'
PROMPT+='${GIT_PROMPT_KIT_CONFLICTED:+$GIT_PROMPT_KIT_CONFLICTED }'
PROMPT+='${GIT_PROMPT_KIT_UNTRACKED:+$GIT_PROMPT_KIT_UNTRACKED }'
PROMPT+='${GIT_PROMPT_KIT_STATUS_EXTENDED:+$GIT_PROMPT_KIT_STATUS_EXTENDED }'

oh-my-git-like

omg's oppa-lana-style. Requires a Font Awesome-patched font, see https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched

# ~/.zshrc
# --- snip ---
# Configure Git Prompt Kit
# support hexadecimal colors
[[ $COLORTERM = *(24bit|truecolor)* ]] || zmodload zsh/nearcolor

GIT_PROMPT_KIT_COLOR_ASSUME_UNCHANGED="#03343f"
GIT_PROMPT_KIT_COLOR_CWD="white"
GIT_PROMPT_KIT_COLOR_HEAD="#03343f"
GIT_PROMPT_KIT_COLOR_INACTIVE="#eee8d9"
GIT_PROMPT_KIT_COLOR_REMOTE="#03343f"
GIT_PROMPT_KIT_COLOR_SKIP_WORKTREE="#03343f"
GIT_PROMPT_KIT_COLOR_STAGED="#03343f"
GIT_PROMPT_KIT_COLOR_STASH="#03343f"
GIT_PROMPT_KIT_COLOR_SUCCEEDED="white"
GIT_PROMPT_KIT_COLOR_TAG="#03343f"
GIT_PROMPT_KIT_COLOR_UNSTAGED="#e0323b"
GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT=2
GIT_PROMPT_KIT_REPO_SUBDIRECTORY_MAX_TRAILING_COUNT=2
GIT_PROMPT_KIT_SHOW_INACTIVE_STATUS=0
GIT_PROMPT_KIT_SYMBOL_AHEAD="  "
GIT_PROMPT_KIT_SYMBOL_BEHIND="  "
GIT_PROMPT_KIT_SYMBOL_CHAR_NORMAL=•
GIT_PROMPT_KIT_SYMBOL_COMMIT="  "
GIT_PROMPT_KIT_SYMBOL_DELETED="  "
GIT_PROMPT_KIT_SYMBOL_DELETED_STAGED="  "
GIT_PROMPT_KIT_SYMBOL_MODIFIED="  "
GIT_PROMPT_KIT_SYMBOL_MODIFIED_STAGED="  "
GIT_PROMPT_KIT_SYMBOL_NEW="  "
GIT_PROMPT_KIT_SYMBOL_TAG="  "
GIT_PROMPT_KIT_SYMBOL_UNTRACKED="  "

# Load Git Prompt Kit (will differ depending on installation method)

# Build prompt
PROMPT=
PROMPT+='%K{#eee8d9}%F{#03343f}'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+   }'
PROMPT+='${GIT_PROMPT_KIT_STATUS_EXTENDED:+$GIT_PROMPT_KIT_STATUS_EXTENDED }'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED:+$GIT_PROMPT_KIT_MODIFIED }'
PROMPT+='${GIT_PROMPT_KIT_DELETED:+$GIT_PROMPT_KIT_DELETED }'
PROMPT+='${GIT_PROMPT_KIT_NEW:+$GIT_PROMPT_KIT_NEW }'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED_STAGED:+$GIT_PROMPT_KIT_MODIFIED_STAGED }'
PROMPT+='${GIT_PROMPT_KIT_DELETED_STAGED:+$GIT_PROMPT_KIT_DELETED_STAGED }'
PROMPT+='${GIT_PROMPT_KIT_CONFLICTED:+$GIT_PROMPT_KIT_CONFLICTED }'
PROMPT+='${GIT_PROMPT_KIT_ACTION:+$GIT_PROMPT_KIT_ACTION }'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+ }'
PROMPT+='%k'
PROMPT+='%K{#e0323b}%F{#eee8d9}${GIT_PROMPT_KIT_HEAD:+}%F{#03343f}${GIT_PROMPT_KIT_HEAD:+ }'
PROMPT+='${GIT_PROMPT_KIT_BEHIND:+$GIT_PROMPT_KIT_BEHIND }'
PROMPT+='${GIT_PROMPT_KIT_AHEAD:+$GIT_PROMPT_KIT_AHEAD }'
PROMPT+='%F{#03343f}'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+($GIT_PROMPT_KIT_HEAD}'
PROMPT+='${GIT_PROMPT_KIT_REMOTE:+$ GIT_PROMPT_KIT_REMOTE}'
PROMPT+='%F{#03343f}'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+) }'
PROMPT+='${GIT_PROMPT_KIT_TAG:+$GIT_PROMPT_KIT_TAG }'
PROMPT+='%k%F{#e0323b}${GIT_PROMPT_KIT_HEAD:+}%k'
PROMPT+=$'\n'
PROMPT+='$GIT_PROMPT_KIT_CWD '
PROMPT+='$GIT_PROMPT_KIT_CHAR '

Pure-like

# ~/.zshrc
# --- snip ---
# Configure Git Prompt Kit
# support hexadecimal colors
[[ $COLORTERM = *(24bit|truecolor)* ]] || zmodload zsh/nearcolor

GIT_PROMPT_KIT_COLOR_ACTION=242
GIT_PROMPT_KIT_COLOR_ASSUME_UNCHANGED=cyan
GIT_PROMPT_KIT_COLOR_CWD=blue
GIT_PROMPT_KIT_COLOR_FAILED=red
GIT_PROMPT_KIT_COLOR_HEAD="#6c6c6c"
GIT_PROMPT_KIT_COLOR_HOST=242
GIT_PROMPT_KIT_COLOR_REMOTE=cyan
GIT_PROMPT_KIT_COLOR_SKIP_WORKTREE=cyan
GIT_PROMPT_KIT_COLOR_STASH=cyan
GIT_PROMPT_KIT_COLOR_SUCCEEDED=magenta
GIT_PROMPT_KIT_COLOR_USER=242
GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT=-1
GIT_PROMPT_KIT_GIT_STATUS_ON_OWN_LINE=0
GIT_PROMPT_KIT_REPO_SUBDIRECTORY_MAX_TRAILING_COUNT=-1
GIT_PROMPT_KIT_SHOW_INACTIVE_STATUS=0
GIT_PROMPT_KIT_SYMBOL_AHEAD=⇡
GIT_PROMPT_KIT_SYMBOL_BEHIND=⇣
GIT_PROMPT_KIT_SYMBOL_CHAR_NORMAL=❯
GIT_PROMPT_KIT_SYMBOL_STASH=≡

# Load Git Prompt Kit (will differ depending on installation method)

# Build prompt
dirty_prompt_marker='%F{218}*%F{$GIT_PROMPT_KIT_COLOR_INACTIVE}'
PROMPT=
PROMPT+=$'\n'
PROMPT+='$GIT_PROMPT_KIT_CWD'
PROMPT+='${GIT_PROMPT_KIT_HEAD:+ $GIT_PROMPT_KIT_HEAD}'
PROMPT+='${GIT_PROMPT_KIT_DIRTY:+$dirty_prompt_marker}'
PROMPT+='${GIT_PROMPT_KIT_ACTION:+ $GIT_PROMPT_KIT_ACTION}'
PROMPT+='${GIT_PROMPT_KIT_BEHIND:+ $GIT_PROMPT_KIT_BEHIND}'
PROMPT+='${GIT_PROMPT_KIT_AHEAD:+ $GIT_PROMPT_KIT_AHEAD}'
PROMPT+='${GIT_PROMPT_KIT_STATUS_EXTENDED:+ $GIT_PROMPT_KIT_STATUS_EXTENDED}'
PROMPT+=$'\n'
PROMPT+='$GIT_PROMPT_KIT_CHAR '

Spaceship-like

Git symbol requires a Powerline-patched font, see https://github.com/powerline/fonts

# ~/.zshrc
# --- snip ---
# Configure Git Prompt Kit
GIT_PROMPT_KIT_COLOR_CWD=blue
GIT_PROMPT_KIT_COLOR_HEAD=magenta
GIT_PROMPT_KIT_COLOR_SKIP_WORKTREE=yellow
GIT_PROMPT_KIT_COLOR_STAGED=green
GIT_PROMPT_KIT_COLOR_STASH=yellow
GIT_PROMPT_KIT_COLOR_UNSTAGED=red
GIT_PROMPT_KIT_CWD_MAX_TRAILING_COUNT=2
GIT_PROMPT_KIT_REPO_SUBDIRECTORY_MAX_TRAILING_COUNT=2
GIT_PROMPT_KIT_SHOW_INACTIVE_STATUS=0
GIT_PROMPT_KIT_SYMBOL_AHEAD=⇡
GIT_PROMPT_KIT_SYMBOL_BEHIND=⇣
GIT_PROMPT_KIT_SYMBOL_BRANCH=" "
GIT_PROMPT_KIT_SYMBOL_CHAR_NORMAL="➜ "
GIT_PROMPT_KIT_SYMBOL_CONFLICTED="="
GIT_PROMPT_KIT_SYMBOL_DELETED="✘ "
GIT_PROMPT_KIT_SYMBOL_DELETED_STAGED="✘ "
GIT_PROMPT_KIT_SYMBOL_MODIFIED=!
GIT_PROMPT_KIT_SYMBOL_MODIFIED_STAGED=!
GIT_PROMPT_KIT_SYMBOL_ADDED="+"
GIT_PROMPT_KIT_SYMBOL_NEW="+"
GIT_PROMPT_KIT_SYMBOL_STASH="$"
GIT_PROMPT_KIT_SYMBOL_UNTRACKED="?"

# Load Git Prompt Kit (will differ depending on installation method)

# Build prompt
PROMPT=
PROMPT+=$'\n%B'
PROMPT+='$GIT_PROMPT_KIT_CWD '
PROMPT+='${GIT_PROMPT_KIT_HEAD:+on $GIT_PROMPT_KIT_HEAD }'
PROMPT+='${GIT_PROMPT_KIT_REMOTE:+$GIT_PROMPT_KIT_REMOTE }'
PROMPT+='%F{red}'
PROMPT+='${GIT_PROMPT_KIT_DIRTY:+[}'
PROMPT+='%f'
PROMPT+='${GIT_PROMPT_KIT_BEHIND:+$GIT_PROMPT_KIT_BEHIND}'
PROMPT+='${GIT_PROMPT_KIT_ACTION:+$GIT_PROMPT_KIT_ACTION}'
PROMPT+='${GIT_PROMPT_KIT_UNTRACKED:+$GIT_PROMPT_KIT_UNTRACKED}'
PROMPT+='${GIT_PROMPT_KIT_NEW:+$GIT_PROMPT_KIT_NEW}'
PROMPT+='${GIT_PROMPT_KIT_DELETED_STAGED:+$GIT_PROMPT_KIT_DELETED_STAGED}'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED_STAGED:+$GIT_PROMPT_KIT_MODIFIED_STAGED}'
PROMPT+='${GIT_PROMPT_KIT_MODIFIED:+$GIT_PROMPT_KIT_MODIFIED}'
PROMPT+='${GIT_PROMPT_KIT_DELETED:+$GIT_PROMPT_KIT_DELETED}'
PROMPT+='${GIT_PROMPT_KIT_STASHES:+$GIT_PROMPT_KIT_STASHES}'
PROMPT+='${GIT_PROMPT_KIT_ASSUMED_UNCHANGED:+$GIT_PROMPT_KIT_ASSUMED_UNCHANGED}'
PROMPT+='${GIT_PROMPT_KIT_SKIP_WORKTREE:+$GIT_PROMPT_KIT_SKIP_WORKTREE}'
PROMPT+='${GIT_PROMPT_KIT_CONFLICTED:+$GIT_PROMPT_KIT_CONFLICTED}'
PROMPT+='%F{red}'
PROMPT+='${GIT_PROMPT_KIT_DIRTY:+]}'
PROMPT+='%f'
PROMPT+=$'%b\n'
PROMPT+='$GIT_PROMPT_KIT_CHAR '