aboutsummaryrefslogtreecommitdiff
path: root/zshrc.d/prompt
blob: b2e155b95fb1e6a838205a26cbe0daeba196bf08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# vim: ft=zsh

# Disable default prompt
command -v prompt >/dev/null && prompt off

if [ "$UID" -eq 0 ]; then
	NCOLOR="red"
elif [ -n "$IN_NIX_SHELL" ]; then
	NCOLOR="yellow"
else
	NCOLOR="green"
fi
PROMPT="%(?..%{$fg_bold[yellow]%}EXIT: %?
)%{$fg_bold[$NCOLOR]%}%n@%m:%{$fg_bold[blue]%}%1~%{$fg_bold[$NCOLOR]%}%(!.#.$)%{$reset_color%} "
unset NCOLOR

for gitprompt in "/usr/share/git/git-prompt.sh" "/run/current-system/sw/share/bash-completion/completions/git-prompt.sh"; do
	if [ -e "$gitprompt"  ]; then
		source "$gitprompt"
		export GIT_PS1_SHOWCOLORHINTS=y
		export GIT_PS1_SHOWDIRTYSTATE=y
		export GIT_PS1_SHOWUNTRACKEDFILES=y
		export GIT_PS1_SHOWUPSTREAM="auto"
		export GIT_PS1_STATESEPARATOR=""
		export GIT_PS1_SHOWUPSTREAM=y
		export GIT_PS1_DESCRIBE_STYLE="branch"
		RPROMPT='$(__git_ps1 "%s")'
		setopt promptsubst
		break
	fi
done
unset gitprompt