Created
July 22, 2016 10:04
-
-
Save lukemorton/9c364e7ca142ba2408fef86fc9e60599 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 ' > ' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment