blob: cab4b8c58041bdc89bf7c663b291cb8626b2bb3b (
plain)
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
|
# name: Sorin
# author: Ivan Tham <ivanthamjunhoe@gmail.com>
function fish_prompt
test $SSH_TTY; and printf (set_color red)(whoami)(set_color white)'@'(set_color yellow)(hostname)' '
test $USER = 'root'; and echo (set_color red)"#"
# Main
echo -n (set_color cyan)(prompt_pwd) (set_color red)'❯'(set_color yellow)'❯'(set_color green)'❯ '
end
function fish_right_prompt
# last status
test $status != 0; and printf (set_color red)"⏎ "
if git rev-parse ^ /dev/null
# Purple if branch detached else green
git branch -qv | grep "\*" | grep -q detached
and set_color purple --bold
or set_color green --bold
# Need optimization on this block (eliminate space)
git name-rev --name-only HEAD
# Merging state
git merge -q ^ /dev/null; or printf ':'(set_color red)'merge'
printf ' '
# Symbols
for i in (git branch -qv --no-color|grep \*|cut -d' ' -f4-|cut -d] -f1|tr , \n)\
(git status --porcelain | cut -c 1-2 | uniq)
switch $i
case "*[ahead *"
printf (set_color purple)⬆' '
case "*behind *"
printf (set_color purple)⬇' '
case "."
printf (set_color green)✚' '
case " D"
printf (set_color red)✖' '
case "*M*"
printf (set_color blue)✱' '
case "*R*"
printf (set_color purple)➜' '
case "*U*"
printf (set_color brown)═' '
case "??"
printf (set_color white)◼' '
end
end
end
end
|