dotfiles/home/.config/sh/theme

34 lines
741 B
Plaintext
Raw Normal View History

#!/usr/bin/env zsh
# Color definition
GRAY="%F{237}"
RED="%F{196}"
ORANGE="%F{214}"
BLUE="%F{032}"
LBLUE="%F{075}"
PURPLE="%F{105}"
RESET="%f"
git_prompt() {
2021-01-28 23:39:51 +00:00
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo -n "$ORANGE${ref#refs/heads/}"
if [ ! -z "$(git status --short)" ]; then
2021-01-28 23:39:51 +00:00
echo "$RED+"
fi
}
2021-01-28 23:39:51 +00:00
setopt PROMPT_SUBST
# Primary Prompt
[ "$EUID" -eq 0 ] && PS1="$RED%n@%m$RESET" || PS1="$GRAY%n@%m$RESET" # user@machine
PS1+=" $BLUE%~" # Working directory
2021-01-28 23:39:51 +00:00
PS1+=" \$(git_prompt)"
PS1+=" $PURPLE%(!.#.»)$RESET " # Final symbol (# or »)
# Next line prompt
PS2="$RED\ $RESET"
# Right side prompt (on error)
RPS1="%(?..$RED%? ↵$RESET)"