fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
867946468
master
1# name: Acidhub 2# author: Acidhub - https://acidhub.click/ 3 4function fish_prompt -d"Write out the prompt" 5set -l laststatus$status 6 7set -l git_info 8if git rev-parse2> /dev/null 9set -l git_branch( 10command git symbolic-ref HEAD2> /dev/null| string replace'refs/heads/' '' 11or command git describe HEAD2> /dev/null 12or echo unknown 13) 14set git_branch( set_color -o blue) " $git_branch " 15set -l git_status 16if git rev-parse --quiet --verify HEAD> /dev/null 17and not command git diff-index --quiet HEAD -- 18 19for iin ( git status --porcelain| string sub -l2 | sort | uniq ) 20switch $i 21case "." 22set git_status" $git_status " ( set_color green) ✚ 23case " D" 24set git_status" $git_status " ( set_color red) ✖ 25case "*M*" 26set git_status" $git_status " ( set_color green) ✱ 27case "*R*" 28set git_status" $git_status " ( set_color purple) ➜ 29case "*U*" 30set git_status" $git_status " ( set_color brown) ═ 31case "??" 32set git_status" $git_status " ( set_color red) ≠ 33end 34end 35else 36set git_status( set_color green) : 37end 38set git_info"(git $git_status$git_branch " ( set_color white) ")" 39end 40 41# Disable PWD shortening by default. 42set -q fish_prompt_pwd_dir_length 43or set -lx fish_prompt_pwd_dir_length0 44 45set_color -b black 46printf '%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) ( prompt_pwd ) ( set_color white) $git_info ( set_color white) '❱' ( set_color white) 47if test $laststatus -eq 0 48printf "%s✔%s≻%s " ( set_color -o green) ( set_color white) ( set_color --reset) 49else 50printf "%s✘%s≻%s " ( set_color -o red) ( set_color white) ( set_color --reset) 51end 52end