Skip to content

Instantly share code, notes, and snippets.

@vestel
Created August 14, 2013 09:12
Show Gist options
  • Save vestel/6229279 to your computer and use it in GitHub Desktop.
Save vestel/6229279 to your computer and use it in GitHub Desktop.
set fish_credentials_color blue
set fish_git_dirty_color red
function parse_git_dirty
git diff --quiet HEAD ^&-
if test $status = 1
set_color $fish_git_dirty_color
echo -n "Δ"
set_color normal
end
end
function parse_git_branch
set -l branch (git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
echo -n $branch
echo -n (parse_git_dirty)
end
function fish_prompt
set_color $fish_credentials_color
echo -n (whoami)
echo -n '@'
echo -n (hostname|cut -d . -f 1)
echo -n ' '
set_color $fish_color_cwd
echo -n (prompt_pwd)
echo -n ' '
set_color normal
if test -z (git branch --quiet 1>/dev/null 2>|awk '/fatal:/ {print "no git"}')
echo -n [
echo -n (parse_git_branch)
echo -n ]
else
echo -n ' '
end
echo -n '> '
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment