2015-07-11 12:06:31 +08:00
|
|
|
# name: Acidhub
|
|
|
|
# author: Acidhub - https://acidhub.click/
|
|
|
|
|
|
|
|
function fish_prompt -d "Write out the prompt"
|
|
|
|
set laststatus $status
|
2018-11-11 21:06:05 +08:00
|
|
|
|
|
|
|
if set -l git_branch (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '')
|
|
|
|
set git_branch (set_color -o blue)"$git_branch"
|
|
|
|
if command git diff-index --quiet HEAD --
|
2016-12-17 02:43:40 +08:00
|
|
|
for i in (git branch -qv --no-color | string match -r '\*' | cut -d' ' -f4- | cut -d] -f1 | tr , \n)\
|
2016-11-02 10:19:45 +08:00
|
|
|
(git status --porcelain | cut -c 1-2 | uniq)
|
2015-07-11 12:06:31 +08:00
|
|
|
switch $i
|
|
|
|
case "*[ahead *"
|
|
|
|
set git_status "$git_status"(set_color red)⬆
|
|
|
|
case "*behind *"
|
|
|
|
set git_status "$git_status"(set_color red)⬇
|
|
|
|
case "."
|
|
|
|
set git_status "$git_status"(set_color green)✚
|
|
|
|
case " D"
|
|
|
|
set git_status "$git_status"(set_color red)✖
|
|
|
|
case "*M*"
|
|
|
|
set git_status "$git_status"(set_color green)✱
|
|
|
|
case "*R*"
|
|
|
|
set git_status "$git_status"(set_color purple)➜
|
|
|
|
case "*U*"
|
|
|
|
set git_status "$git_status"(set_color brown)═
|
|
|
|
case "??"
|
|
|
|
set git_status "$git_status"(set_color red)≠
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
set git_status (set_color green):
|
|
|
|
end
|
|
|
|
set git_info "(git$git_status$git_branch"(set_color white)")"
|
|
|
|
end
|
2018-11-11 21:06:05 +08:00
|
|
|
|
2015-07-11 12:06:31 +08:00
|
|
|
set_color -b black
|
2016-11-02 10:19:45 +08:00
|
|
|
printf '%s%s%s%s%s%s%s%s%s%s%s%s%s' (set_color -o white) '❰' (set_color green) $USER (set_color white) '❙' (set_color yellow) (echo $PWD | sed -e "s|^$HOME|~|") (set_color white) $git_info (set_color white) '❱' (set_color white)
|
2015-07-11 12:06:31 +08:00
|
|
|
if test $laststatus -eq 0
|
2016-11-02 10:19:45 +08:00
|
|
|
printf "%s✔%s≻%s " (set_color -o green) (set_color white) (set_color normal)
|
2015-07-11 12:06:31 +08:00
|
|
|
else
|
2016-11-02 10:19:45 +08:00
|
|
|
printf "%s✘%s≻%s " (set_color -o red) (set_color white) (set_color normal)
|
2015-07-11 12:06:31 +08:00
|
|
|
end
|
|
|
|
end
|