-
Notifications
You must be signed in to change notification settings - Fork 42
/
arialdo-pathinline.zsh-theme
executable file
·143 lines (125 loc) · 4.86 KB
/
arialdo-pathinline.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Symbols
: ${omg_is_a_git_repo_symbol:='❤'}
: ${omg_has_untracked_files_symbol:='∿'}
: ${omg_has_adds_symbol:='+'}
: ${omg_has_deletions_symbol:='-'}
: ${omg_has_cached_deletions_symbol:='✖'}
: ${omg_has_modifications_symbol:='✎'}
: ${omg_has_cached_modifications_symbol:='☲'}
: ${omg_ready_to_commit_symbol:='→'}
: ${omg_is_on_a_tag_symbol:='⌫'}
: ${omg_needs_to_merge_symbol:='ᄉ'}
: ${omg_has_upstream_symbol:='⇅'}
: ${omg_detached_symbol:='⚯ '}
: ${omg_can_fast_forward_symbol:='»'}
: ${omg_has_diverged_symbol:='Ⴤ'}
: ${omg_rebase_tracking_branch_symbol:='↶'}
: ${omg_merge_tracking_branch_symbol:='ᄉ'}
: ${omg_should_push_symbol:='↑'}
: ${omg_has_stashes_symbol:='★'}
# Flags
: ${omg_display_has_upstream:=false}
: ${omg_display_tag:=false}
: ${omg_display_tag_name:=true}
: ${omg_two_lines:=false}
: ${omg_finally:=''}
: ${omg_use_color_off:=false}
#load colors
autoload colors && colors
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval $COLOR='%{$fg_no_bold[${(L)COLOR}]%}' #wrap colours between %{ %} to avoid weird gaps in autocomplete
eval BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
eval RESET='%{$reset_color%}'
omg_default_color_on=$WHITE
omg_default_color_off=$WHITE
red=$RED
green=$GREEN
yellow=$YELLOW
violet=$CYAN
reset=$RESET
PROMPT='$(build_prompt)%{$fg_bold[green]%}
%~%{$fg_bold[white]%} ∙ '
RPROMPT='%{$reset_color%}%T %{$fg_bold[white]%} %n@%m%{$reset_color%}'
function custom_build_prompt {
local enabled=${1}
local current_commit_hash=${2}
local is_a_git_repo=${3}
local current_branch=$4
local detached=${5}
local just_init=${6}
local has_upstream=${7}
local has_modifications=${8}
local has_modifications_cached=${9}
local has_adds=${10}
local has_deletions=${11}
local has_deletions_cached=${12}
local has_untracked_files=${13}
local ready_to_commit=${14}
local tag_at_current_commit=${15}
local is_on_a_tag=${16}
local has_upstream=${17}
local commits_ahead=${18}
local commits_behind=${19}
local has_diverged=${20}
local should_push=${21}
local will_rebase=${22}
local has_stashes=${23}
local prompt=""
if [[ $is_a_git_repo == true ]]; then
enrich $is_a_git_repo $omg_is_a_git_repo_symbol $violet
enrich $has_stashes $omg_has_stashes_symbol $yellow
enrich $has_untracked_files $omg_has_untracked_files_symbol $red
enrich $has_adds $omg_has_adds_symbol $yellow
enrich $has_deletions $omg_has_deletions_symbol $red
enrich $has_deletions_cached $omg_has_cached_deletions_symbol $yellow
enrich $has_modifications $omg_has_modifications_symbol $red
enrich $has_modifications_cached $omg_has_cached_modifications_symbol $yellow
enrich $ready_to_commit $omg_ready_to_commit_symbol $green
enrich $detached $omg_detached_symbol $red
if [[ $omg_display_has_upstream == true ]]; then
enrich $has_upstream $omg_has_upstream_symbol
fi
if [[ $detached == true ]]; then
if [[ $just_init == true ]]; then
prompt="${prompt} ${red}detached"
else
prompt="${prompt} ${omg_default_color_on}(${current_commit_hash:0:7})"
fi
else
if [[ $has_upstream == true ]]; then
if [[ $will_rebase == true ]]; then
local type_of_upstream=$omg_rebase_tracking_branch_symbol
else
local type_of_upstream=$omg_merge_tracking_branch_symbol
fi
if [[ $has_diverged == true ]]; then
prompt="${prompt}-${commits_behind} ${omg_has_diverged_symbol} +${commits_ahead} "
else
if [[ $commits_behind -gt 0 ]]; then
prompt="${prompt}${omg_default_color_on} -${commits_behind} ${omg_can_fast_forward_symbol} "
fi
if [[ $commits_ahead -gt 0 ]]; then
prompt="${prompt}${omg_default_color_on} ${omg_should_push_symbol} +${commits_ahead} "
fi
fi
prompt="${prompt}(${green}${current_branch}${reset} ${type_of_upstream} ${upstream//\/$current_branch/})"
else
prompt="${prompt}${omg_default_color_on}(${green}${current_branch}${reset})"
fi
fi
if [[ $omg_display_tag == true && $is_on_a_tag == true ]]; then
prompt="${prompt} ${yellow}${omg_is_on_a_tag_symbol}${reset}"
fi
if [[ $omg_display_tag_name == true && $is_on_a_tag == true ]]; then
prompt="${prompt} ${yellow}[${tag_at_current_commit}]${reset}"
fi
prompt="${prompt} "
fi
if [[ $omg_two_lines == true && $is_a_git_repo == true ]]; then
break='\n'
else
break=''
fi
echo "${prompt}${reset}${break}${omg_finally}"
}