Created
March 19, 2020 09:55
-
-
Save lukemorton/fffe47e6eacc2131afe6714846479d91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function g; git $argv; end | |
function ll; ls -laH $argv; end | |
function _git_branch_name | |
set -l branch (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') | |
if test -n "$branch" | |
echo $branch | |
else | |
set -l commit (command git rev-parse --short HEAD ^/dev/null) | |
if test -n "$commit" | |
set_color red | |
echo $commit | |
end | |
end | |
end | |
function _git_status_symbol | |
set -l stashed (command git stash list ^/dev/null | tail -n1) | |
set -l changed (command git status --porcelain ^/dev/null) | |
if test -n "$stashed" | |
echo -n '$' | |
end | |
if test -n "$changed" | |
set -l dirty (command git diff --shortstat ^/dev/null) | |
if test -n "$dirty" | |
echo -n '*' | |
else | |
echo -n '+' | |
end | |
end | |
echo '' | |
end | |
function git_prompt | |
set -l git_status (_git_branch_name)(_git_status_symbol) | |
if test -n "$git_status" | |
echo -n " " | |
set_color cyan | |
echo -n "$git_status" | |
set_color normal | |
end | |
end | |
function fish_prompt | |
set_color $fish_color_cwd | |
printf '%s' (prompt_pwd) | |
set_color normal | |
git_prompt | |
set_color $fish_color_cwd | |
echo | |
echo 'λ ' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment