NixOS_NoFlake/home/config/fish/functions/gitinfo.fish

19 lines
563 B
Fish

function gitinfo
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
set -l branch (git branch --show-current)
set -l staged ""
set -l dirty ""
set -l untracked ""
if not git diff --quiet
set dirty (set_color yellow)"*"
end
if not git diff --cached --quiet
set staged (set_color green)"+"
end
set -l untracked_files (git ls-files --others --exclude-standard)
if test -n "$untracked_files"
set untracked (set_color red)" *"
end
echo (set_color magenta)"($branch)"$staged$dirty$untracked(set_color normal)
end
end