-
Notifications
You must be signed in to change notification settings - Fork 0
/
princess.zsh-theme
88 lines (66 loc) · 2.71 KB
/
princess.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
local pink=#ff87df
local white=#ffffff
local blue=#00d7ff
local success=💖
local failure=😭
local italstart=$(echo "\e[3m")
local italend=$(echo "\e[23m")
autoload -Uz vcs_info
setopt PROMPT_SUBST
precmd() {
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
# If we're inside a git repository, prepare to display git info
local unstaged_count=$(git diff --numstat | wc -l | sed 's/^[[:space:]]*//g')
local staged_count=$(git diff --cached --numstat | wc -l | sed 's/^[[:space:]]*//g')
local untracked_count=$(git ls-files --others --exclude-standard | wc -l | sed 's/^[[:space:]]*//g')
local branch=$(git branch --show-current)
git_prompt="%B%F{$pink}%K{$pink}%F{black}👑 %F{$white}${branch} "
if ((staged_count!=0)); then
git_prompt+="%F{$white}${staged_count}♥ "
fi
if ((unstaged_count!=0)); then
git_prompt+="%F{$white}${unstaged_count}♡ "
fi
if ((untracked_count!=0)); then
git_prompt+="%F{$white}${untracked_count}❣ "
fi
git_prompt+="%k"
else
git_prompt=""
fi
last_stat="%(?.${success}.${failure})"
# Set up the prompt
prompt1="%F{$pink}╭──%B%F{$pink}%F{$white}%}%K{${pink}%} $italstart%n$italend %K{${white}}%F{${pink}} %m %f%k%F{${${white}}} %B%F{${white}}→%F{${${blue}}} %b%3~ %f"
prompt2="%F{$pink}╰──${last_stat}%f"
}
separator() {
local sep="%F{$pink}"
local terminal_width=$(tput cols)
local prompt_len=${#${(%):---- %n---%m-- - %3~ }}
local git_prompt_skel=""
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
local unstaged_count=$(git diff --numstat | wc -l | sed 's/^[[:space:]]*//g')
local staged_count=$(git diff --cached --numstat | wc -l | sed 's/^[[:space:]]*//g')
local untracked_count=$(git ls-files --others --exclude-standard | wc -l | sed 's/^[[:space:]]*//g')
local current_branch=$(git branch --show-current)
git_prompt_skel+=" 👑${current_branch} "
if ((staged_count!=0)); then
git_prompt_skel+="${staged_count}+ "
fi
if ((unstaged_count!=0)); then
git_prompt_skel+="${unstaged_count}* "
fi
if ((untracked_count!=0)); then
git_prompt_skel+="${untracked_count}! "
fi
fi
local git_prompt_len=${#git_prompt_skel}
separator_len=$((terminal_width - prompt_len - git_prompt_len))
for ((i=0; i < separator_len; i++)); do
sep+="─"
done
echo "$sep"
}
PROMPT='${prompt1}%F{#644}$(separator)$git_prompt%f%k%b
${prompt2} '
RPROMPT='%F{#f00}$(if [ $? -ne 0 ]; then echo "%? "; fi)%f $(date "+%I:%M:%S %p")'