mirror of
https://tildegit.org/ben/dotfiles.git
synced 2025-03-28 17:00:41 +00:00
a couple nice git things in the right_prompt
This commit is contained in:
parent
3b4c981ccc
commit
48c60eb6d4
20
fish/.config/fish/functions/fish_right_prompt.fish
Normal file
20
fish/.config/fish/functions/fish_right_prompt.fish
Normal file
@ -0,0 +1,20 @@
|
||||
function fish_right_prompt
|
||||
if is_git
|
||||
if is_git_dirty
|
||||
set_color --underline
|
||||
end
|
||||
|
||||
set_color yellow
|
||||
|
||||
if is_git_ahead
|
||||
echo -n '^'
|
||||
else
|
||||
echo -n '='
|
||||
end
|
||||
echo -n ' '
|
||||
|
||||
echo -n (git_branch)
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
5
fish/.config/fish/functions/git_branch.fish
Normal file
5
fish/.config/fish/functions/git_branch.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function git_branch
|
||||
if is_git
|
||||
echo (git rev-parse --abbrev-ref HEAD ^/dev/null)
|
||||
end
|
||||
end
|
3
fish/.config/fish/functions/is_git.fish
Normal file
3
fish/.config/fish/functions/is_git.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function is_git
|
||||
git symbolic-ref HEAD > /dev/null ^&1
|
||||
end
|
4
fish/.config/fish/functions/is_git_ahead.fish
Normal file
4
fish/.config/fish/functions/is_git_ahead.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function is_git_ahead
|
||||
set -l revs (git rev-list origin/(git_branch)..HEAD ^/dev/null)
|
||||
[ "$revs" != "" ]
|
||||
end
|
3
fish/.config/fish/functions/is_git_dirty.fish
Normal file
3
fish/.config/fish/functions/is_git_dirty.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function is_git_dirty
|
||||
is_git; and [ (git status | tail -n1) != "nothing to commit, working tree clean" ]
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user