forked from akabiru/rafiki-zsh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rafiki.zsh-theme
92 lines (76 loc) · 1.97 KB
/
rafiki.zsh-theme
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
declare -A good
declare -A bad
good[muscle]=💪
good[facepunch]=👊
good[smile]=😄
good[sunglasses]=😎
good[thumbsup]=👍
good[okhand]=👌
good[winking]=😉
good[clap]=👏
good[geek]=🤓
good[handsup]=🙌
bad[rollingeyes]=🙄
bad[pouting]=😡
bad[confused]=😕
bad[worried]=😟
bad[nervous]=😰
bad[scream]=😱
bad[thumbsdown]=👎
bad[hushed]=😯
bad[grimacing]=😬
bad[expressionless]=😑
bad[frowning]=☹️
# create an array of good emoji names
local -a goodemojis
for k in "${(@k)good}"; do
goodemojis+=( "$k" )
done
# create an array of bad emoji names
local -a bademojis
for k in "${(@k)bad}"; do
bademojis+=( "$k" )
done
# Get size
G=${#goodemojis[@]}
B=${#bademojis[@]}
# Random value
((G=(RANDOM%G)+1))
((B=(RANDOM%B)+1))
# Get random emoji names
G="$goodemojis[$G]"
B="$bademojis[$B]"
if [[ -n "$MY_GOOD_RAFIKI" ]]; then
if [[ -n "$good[$MY_GOOD_RAFIKI]" ]]; then
RAFIKI_GOOD=good[$MY_GOOD_RAFIKI]
else
echo "$fg_bold[red]$MY_GOOD_RAFIKI is invalid, setting a random one..."
RAFIKI_GOOD="$good[$G]"
fi
else
RAFIKI_GOOD="$good[$G]"
fi
if [[ -n "$MY_BAD_RAFIKI" ]]; then
if [[ -n "$bad[$MY_BAD_RAFIKI]" ]]; then
RAFIKI_BAD=bad[$MY_BAD_RAFIKI]
else
echo "$fg_bold[red]$MY_BAD_RAFIKI is invalid, setting a random one..."
RAFIKI_BAD="$bad[$B]"
fi
else
RAFIKI_BAD="$bad[$B]"
fi
local message="$fg_bold[green]$RAFIKI_GOOD Rafiki, shikilia uzito! $fg_bold[red]$RAFIKI_BAD Kaa rada!"
if [[ -z "$RAFIKI_QUIET" ]]; then
echo "${message}"
fi
alias rafiki='echo "${message}"'
alias newrafiki='source ~/.zshrc'
NEWLINE='
👉 '
local ret_status="%(?:%{$fg_bold[green]%}$RAFIKI_GOOD :%{$fg_bold[red]%}$RAFIKI_BAD )"
PROMPT='${ret_status} %{$fg[cyan]%}% $USER@%m%{$reset_color%} %~ $(git_prompt_info) $NEWLINE '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"