I enjoyed bobthefish quite a bit, but the nerd fonts on the CLI were screwing up Emacs, and that's a non-starter for me. One thing I like about cmorrell is that it has the host in the terminal line, so I can tell which machine I'm on.
29 lines
832 B
Fish
29 lines
832 B
Fish
|
|
function get_git_status -d "Gets the current git status"
|
|
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
|
set -l dirty (command git status -s --ignore-submodules=dirty | wc -l | sed -e 's/^ *//' -e 's/ *$//' 2> /dev/null)
|
|
set -l ref (command git describe --tags --exact-match ^/dev/null ; or command git symbolic-ref --short HEAD 2> /dev/null ; or command git rev-parse --short HEAD 2> /dev/null)
|
|
|
|
if [ "$dirty" != "0" ]
|
|
set_color -b normal
|
|
set_color red
|
|
echo "$dirty changed file"
|
|
if [ "$dirty" != "1" ]
|
|
echo "s"
|
|
end
|
|
echo " "
|
|
set_color -b red
|
|
set_color white
|
|
else
|
|
set_color -b cyan
|
|
set_color white
|
|
end
|
|
|
|
echo " $ref "
|
|
set_color normal
|
|
end
|
|
end
|
|
|
|
function fish_right_prompt -d "Prints right prompt"
|
|
get_git_status
|
|
end |