Add fish, scripts and git
This commit is contained in:
27
fish/functions/fish_right_prompt.fish
Normal file
27
fish/functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function fish_right_prompt
|
||||
set -l ref (git symbolic-ref HEAD ^/dev/null)
|
||||
if test -z $ref
|
||||
return
|
||||
end
|
||||
|
||||
git diff --no-ext-diff --quiet --exit-code ^/dev/null
|
||||
or set -l dirty 'yes'
|
||||
|
||||
git diff-index --cached --quiet HEAD -- ^/dev/null
|
||||
or set -l staged 'yes'
|
||||
|
||||
set_color normal
|
||||
echo -sn '['
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user