summaryrefslogtreecommitdiff
path: root/.config/zsh/themes/ewout.zsh-theme
blob: 01f8fbe8184a9899a3d3b7c811d2a8f481a47377 (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
33
34
35
36
37
autoload colors && colors
setopt prompt_subst

__git() {
	command -v git > /dev/null || return
	[[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == true ]] && echo "󰘬 $(git branch --show-current)"
}

__wrap() {
	[ -z "$@" ] && return
	echo "─[$@]─"
}

__exitStatus() {
	code=$1
	[ $1 != 0 ] && echo $code
}

__exitFace() {
	code=$1
	[ $1 = 0 ] && echo "$fg[green]:3$reset_color"
	[ $1 != 0 ] && echo "$fg[red]D:$reset_color"
}

__prompt() {
	echo "%# "
}

__generate_prompt() {
	lastExit="$?"
	cat <<ENDPROMPT
╭$(__wrap $(__exitStatus $lastExit))$(__wrap '%~')$(__wrap '%n')$(__wrap $(__git))┄
╰$(__wrap $(__exitFace $lastExit))┄ $(__prompt)
ENDPROMPT
}

PROMPT='$(__generate_prompt)'