-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy-fish_prompt.fish
51 lines (41 loc) · 1.17 KB
/
copy-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
function fish_prompt
set -l pwd (set_color 69D2E7)(prompt_pwd)(set_color normal)
set -g __fish_prompt_char "❯"
set -l ve ""
set -l git_output
if type -q git
set detached (set_color black -b FF0000)
if set branch_name (git_branch_name)
set -l gitporcelain (git_porcelain)
set -l git_distance (git_distance)
set -l repo_status
set -l branch_color ""
if test ! -z "$git_distance"
set git_distance "($git_distance)"
end
if git_is_dirty
set branch_color (set_color black -b FF6524 -o) #orange
else
set branch_color (set_color black -b 50AF08 -o) #green
end
if git_is_staged
if git_is_dirty
set git_status "± "
else
set git_status "+ "
end
end
if git_is_empty
set repo_status "●"
end
if git_is_stashed
set repo_status ".."
end
set git_output "$branch_color $branch_name$repo_status$git_distance $N $gitporcelain"
end
end
if set -q VIRTUAL_ENV
set ve (printf "(%s)" (basename $VIRTUAL_ENV))
end
echo -nes "\n$ve $I$pwd $N$git_output\n$__fish_prompt_char "
end