1
0
Fork 0
dotfiles/fish/fish/functions/fish_prompt.fish

21 lines
473 B
Fish
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function fish_prompt --description 'Write out the prompt'
set_color blue
printf (__fish_basedir)
if test -d .git
set_color magenta
__fish_git_need_commit
end
set_color normal
printf ' '
end
function __fish_basedir
echo (pwd | rev | cut -d/ -f1 | rev)
end
function __fish_git_need_commit
/usr/local/bin/git diff --stat 2>/dev/null | awk -F',' '/files? changed/ { lc += $2 + $3 } END {
if (lc > 100) printf " -- Y U NO COMMIT!? --"
}'
end