This repository has been archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
sm.theme.zsh.old
83 lines (71 loc) · 2.38 KB
/
sm.theme.zsh.old
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
#!bin/zsh
# ------------------------[CONFIG]-------------------------
# SM_SMILEYS=1 => with smileys, using "[ಠ_ಠ]" & "[・‿・]"
# SM_SMILEYS=0 => without smileys, using "✘" & "✔︎"
SM_SMILEYS=1
# SM_CORNERS=1 => the prompt's corner aren't rounded: "╭"
# SM_CORNERS=0 => the prompt's corner are rounded: "╓"
SM_CORNERS=1
# SM_MULTILINES=1 => the prompt is displayed on 3 lines
# SM_MULTILINES=0 => the prompt is displayed on 2 lines
SM_MULTILINES=1
# -----------------------[SET PROMPT]----------------------
# 1. SET SMILEYS
set_smileys() {
if [ "$SM_SMILEYS" -eq 1 ] ; then
smileys=("[ಠ_ಠ]" "[・‿・]");
elif [ "$SM_SMILEYS" -eq 0 ] ; then
smileys=(" ✘" " ✔︎");
fi
}
set_smileys
# 2. SET CORNERS
set_corners () {
if [ "$SM_CORNERS" -eq 1 ] ; then
corners=("╓" "╟" "╙");
elif [ "$SM_CORNERS" -eq 0 ] ; then
corners=("╭" "├" "╰");
fi
}
set_corners
set_multilines() {
if [ "$SM_MULTILINES" -eq 1 ] ; then
sm_prompt='$SM_PREFIX $SM_USER $(git_prompt_info) $(git_prompt_status)
$SM_MIDFIX $SM_DIR
$SM_SUFFIX';
elif [ "$SM_MULTILINES" -eq 0 ] ; then
sm_prompt='$SM_PREFIX $SM_USER $SM_DIR $(git_prompt_info) $(git_prompt_status)
$SM_SUFFIX';
fi
}
set_multilines
# display red user if sudo is enabeled
sudo_color() {
if [ "$UID" -eq 0 ] ; then
echo "red";
else
echo "blue";
fi
}
# custom my prompt
return_code="%(?..%F{red}%? - )%F{default}";
SM_USER="%F{$(sudo_color)}%n%F{yellow}@%F{cyan}%m";
SM_DIR="%F{default}%~%F{default}";
SM_CLOCK="${return_code}%F{cyan}%D%F{yellow} / %F{blue}%T";
SM_PREFIX="%F{yellow}${corners[1]}─";
SM_MIDFIX="%F{yellow}${corners[2]}─";
SM_SUFFIX="%F{yellow}${corners[3]}──→%F{default} ";
# set new prompt
PROMPT="$sm_prompt";
RPROMPT="$SM_CLOCK";
# update vcs values
ZSH_THEME_GIT_PROMPT_PREFIX="%F{magenta}git:%F{default}";
ZSH_THEME_GIT_PROMPT_SUFFIX="";
ZSH_THEME_GIT_PROMPT_DIRTY="%F{red}${smileys[1]}%F{default}";
ZSH_THEME_GIT_PROMPT_CLEAN="%F{green}${smileys[2]}%F{default}";
ZSH_THEME_GIT_PROMPT_ADDED="%F{green}●%F{default} ";
ZSH_THEME_GIT_PROMPT_MODIFIED="%F{yellow}◎%F{default} ";
ZSH_THEME_GIT_PROMPT_DELETED="%F{red}○%F{default} ";
ZSH_THEME_GIT_PROMPT_RENAMED="%F{blue}‣%F{default} ";
ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{magenta}✦%F{default} ";
ZSH_THEME_GIT_PROMPT_UNMERGED="%F{magenta}✖%F{default} ";