function fish_prompt
  set -l last_status $status
  set -l cyan (set_color -o cyan)
  set -l yellow (set_color -o yellow)
  set -g red (set_color -o red)
  set -g blue (set_color -o blue)
  set -l green (set_color -o green)
  set -g normal (set_color normal)
  set -l host (hostname -s)
  set -l user (whoami)
  set initial_indicator "$user@$host"

  set -g whitespace ' '

  if test $last_status = 0
    set status_indicator "$green>"
  else
    set status_indicator "$red>"
  end
  set -l cwd $cyan(basename (prompt_pwd))

  if [ (_git_branch_name) -a (_is_git_dirty) ]
    set -l dirty "$yellow ?"
    set git_info "$dirty"
  end

  echo -n -s $initial_indicator $whitespace $cwd $git_info $whitespace $status_indicator $whitespace
end

function _git_branch_name
  echo (command git symbolic-ref HEAD 2>/dev/null | sed -e 's|^refs/heads/||')
end

function _is_git_dirty
  echo (command git status -s --ignore-submodules=dirty 2>/dev/null)
end