-
Notifications
You must be signed in to change notification settings - Fork 0
/
fish_prompt.fish
53 lines (36 loc) · 1.03 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
function fish_prompt
printf '\n'
set_color $fish_color_cwd_root
printf ' '
# print base dir
if test $PWD = "/" >/dev/null 2>/dev/null
set_color --bold $fish_color_cwd_root
printf \/
else if test $PWD = $HOME >/dev/null 2>/dev/null
set_color --bold blue
printf \~
else
set_color --bold blue
printf (basename $PWD)
end
printf ' '
# print git status
if git rev-parse --is-inside-work-tree >/dev/null 2>/dev/null
if test -z (git status --porcelain) >/dev/null 2>/dev/null
# print clean status
set_color normal
printf ' '
printf (git symbolic-ref --short HEAD; or false); printf ' '
else
# print dirty status
set_color normal
set_color yellow
printf ' '
printf (git symbolic-ref --short HEAD; or false); printf ' '
end
end
printf ' '
# print indicator
set_color normal
printf '⋅ '
end