forked from yangwao/omf-theme-slavic-cat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfish_prompt.fish
242 lines (203 loc) · 6.05 KB
/
fish_prompt.fish
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# original slavic-cat forked from Toaster https://github.com/oh-my-fish/theme-toaster
# this was forked from slavic-cat https://github.com/yangwao/omf-theme-slavic-cat
# live long and prosper, loves
# Right Prompt
set -g __pride_right_prompt on
# Colors and Flag Definitions
# trans
set -g __pride_trans_blue 55CDFC
set -g __pride_trans_pink F7A8B8
set -g __pride_flag_trans 55CDFC F7A8B8 FFFFFF F7A8B8 55CDFC
# gay
set -g __pride_color_red FF0018
set -g __pride_color_orange FFA52C
set -g __pride_color_yellow FFFF41
set -g __pride_color_green 008018
set -g __pride_color_blue 0000F9
set -g __pride_color_purple 86007D
set -g __pride_flag_gay FF0018 FFA52C FFFF41 008018 0000F9 86007D
# pan
set -g __pride_color_pan_pink FF1B8D
set -g __pride_color_pan_yellow FFDA00
set -g __pride_color_pan_blue 1BB3FF
set -g __pride_flag_pan FF1B8D FF1B8D FFDA00 FFDA00 1BB3FF 1BB3FF
# nonbinary
set -g __pride_flag_nonbinary FFF430 FFFFFF 9C59D1 191919
# bi
set -g __pride_flag_bi D60270 D60270 9B4F96 9B4F96 0038A8 0038A8
# lesbian
set -g __pride_flag_lesbian D62900 FF9B55 FFFFFF D461A6 A50062
# lipstick
set -g __pride_flag_lipstick A60061 B95594 D162A8 E5ADD1 C64D53 8C1801
# soviet
set -g __pride_color_soviet_red CD0000
set -g __pride_color_soviet_yellow FFD900
# sankara
set -g __pride_flag_sankara FCD116 009E49 EF2B2D F2F2F2 191919
# misc
set -g __pride_color_violet 9C59D1
set -g __pride_color_lilac B77FDD
set -g __pride_color_bright_pink f92673
set -g __pride_color_black 000000
set -g __pride_color_grey 554F48
set -g __pride_color_white F1F1F1
# graphics
set -g __pride_cat_default " (=^・^=)ノ"
set -g __pride_cat_slavic " (^._.^)ノ"
###########################################################
# Functions
function __pride_check_defaults
# bind_mode
if test $__pride_bind_mode = default
set -U __pride_bind_mode off
end
# prompt character
if test $__pride_prompt = "default"
set -g __pride_prompt_char "➤"
end
if test $__pride_prompt = "block"
set -g __pride_prompt_char "█"
end
# cat icon
if test $__pride_cat_status = off
set -g __pride_cat_icon " "
else
switch $__pride_cat
case slavic
eval set -g __pride_cat_icon \$__pride_cat_$__pride_cat
case default
eval set -g __pride_cat_icon \$__pride_cat_$__pride_cat
end
end
# flag
if test $__pride_flag = default
set __pride_flag gay
end
# set current colorscheme
eval set -g __pride_current_flag \$__pride_flag_$__pride_flag
end
function __pride_color_echo
set_color $argv[1]
if test (count $argv) -eq 2
echo -n $argv[2]
end
end
function __pride_current_folder
if test $PWD = '/'
echo -n '/'
else
echo -n $PWD | grep -o -E '[^\/]+$'
end
end
function __pride_git_status_codes
if test (git rev-parse --git-dir 2>/dev/null) > /dev/null
git status --porcelain | sed -E 's/(^.{3}).*/\1/' | tr -d ' \n'
end
end
function __pride_git_branch_name
if test -n (git rev-parse --git-dir > /dev/null 2>&1)
git rev-parse --abbrev-ref HEAD 2>/dev/null
end
end
function __pride_rainbow
if echo $argv[1] | grep -q -e $argv[3]
__pride_color_echo $argv[2] "彡ミ"
end
end
function __pride_git_status_icons
if test (git ls-files 2>/dev/null| wc -l) -lt 1024 # disable for large repos. performance suffers immensely when git tries to index thousands of files. TODO: make this configurable
set -l git_status (__pride_git_status_codes)
__pride_rainbow $git_status $__pride_trans_pink 'D'
__pride_rainbow $git_status $__pride_color_orange 'R'
__pride_rainbow $git_status $__pride_color_white 'C'
__pride_rainbow $git_status $__pride_color_green 'A'
__pride_rainbow $git_status $__pride_color_blue 'U'
__pride_rainbow $git_status $__pride_color_lilac 'M'
__pride_rainbow $git_status $__pride_color_grey '?'
else
__pride_rainbow "?" $__pride_color_grey '?'
end
end
function __pride_print_cat
__pride_color_echo $__pride_color_white $__pride_cat_icon
end
function __pride_git_status
set -l __pride_current_git_branch_name (__pride_git_branch_name)
# In git
if test -n $__pride_current_git_branch_name
__pride_color_echo $__pride_color_white $__pride_current_git_branch_name
if test (__pride_git_status_codes)
__pride_color_echo $__pride_trans_pink ' ●'
__pride_print_cat
__pride_git_status_icons
else
__pride_color_echo $__pride_color_green ' ○'
__pride_print_cat
end
else
if test "$__pride_cat_status" = "on"
__pride_print_cat
end
end
end
function __pride_print_bind_mode
if test "$__pride_bind_mode" != "off"
set_color $__pride_color_lilac
printf '['
switch $fish_bind_mode
case default
set_color red
printf 'n'
case insert
set_color green
printf 'i'
case visual
set_color magenta
printf 'v'
end
set_color $__pride_color_lilac
printf '] '
end
end
function __pride_print_userinfo
if test "$__pride_username" != "off"
__pride_color_echo $__pride_color_bright_pink (whoami)
if test "$__pride_hostname" != "off"
__pride_color_echo $__pride_color_white "@"
__pride_color_echo $__pride_trans_blue (hostname)
end
__pride_color_echo $__pride_color_white ":"
end
end
function __pride_flag_line
if test $__pride_flag != soviet
for color in $__pride_current_flag
__pride_color_echo $color $__pride_prompt_char
end
set_color normal
else if test $__pride_flag = soviet
set_color -b $__pride_color_soviet_red
set_color $__pride_color_soviet_yellow
echo -n " ☭ "
set_color normal
end
echo -n " "
end
#####################################################################
# here we go
####################
function fish_prompt
__pride_check_defaults
__pride_print_bind_mode
__pride_print_userinfo
# print pwd
set_color magenta;echo -n (prompt_pwd);set_color normal;echo -n " "
# __pride_color_echo $__pride_color_violet " "
if test $__pride_commie != on
__pride_color_echo $__pride_color_red " ☭ "
end
__pride_git_status
# new line
echo
__pride_flag_line
end