Lots of stuff. Working on refactoring

This commit is contained in:
Thomas Loven
2017-10-14 09:47:18 +02:00
parent 8230d22739
commit 1b5423997e
23 changed files with 620 additions and 12 deletions

View File

@@ -0,0 +1,34 @@
function fish_right_prompt
# Check if we are inside a version controlled directory (git only)
set -l ref (git symbolic-ref HEAD ^/dev/null)
if test -z $ref
return
end
# Check if any files have changes
git diff --no-ext-diff --quiet --exit-code ^/dev/null
or set -l dirty 'yes'
# Check if any files are staged
git diff-index --cached --quiet HEAD -- ^/dev/null
or set -l staged 'yes'
set_color normal
echo -sn '['
# Print branch name
# red if dirty
# yellow if staged
# green otherwise
if set -q staged
set_color yellow
else if set -q dirty
set_color red
else
set_color green
end
echo -sn (string replace refs/heads/ '' -- $ref)
set_color normal
echo -sn ']'
end