blob: e44e88754796a708081dd3f200348289ca50103c (
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
38
39
40
41
|
autoload colors && colors
setopt prompt_subst
local reset="%{$reset_color%}"
local red="%{${fg[red]}%}"
local green="%{${fg[green]}%}"
__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 "${green}:3$reset"
[ $1 != 0 ] && echo "${red}D:$reset"
}
__prompt() {
echo '%# '
}
__generate_prompt() {
lastExit="$?"
cat <<ENDPROMPT
╭$(__wrap $(__exitStatus $lastExit))$(__wrap '%~')$(__wrap '%n')$(__wrap $(__git))┄
╰$(__wrap $(__exitFace $lastExit))┄ $(__prompt)
ENDPROMPT
}
PROMPT='$(__generate_prompt)'
|