Skip to content

Instantly share code, notes, and snippets.

@JodiWarren
Created June 12, 2014 13:44
Show Gist options
  • Save JodiWarren/083c185c829722425fa8 to your computer and use it in GitHub Desktop.
Save JodiWarren/083c185c829722425fa8 to your computer and use it in GitHub Desktop.
Fish Prompt
set fish_git_dirty_color red
set fish_git_not_dirty_color green
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_diff (git diff)
if test -n "$git_diff"
echo (set_color $fish_git_dirty_color)$branch(set_color normal)
else
echo (set_color $fish_git_not_dirty_color)$branch(set_color normal)
end
end
function fish_prompt
set_color yellow
printf '\n%s' (whoami)
set_color normal
# printf ' at '
# set_color magenta
# printf '%s' (hostname|cut -d . -f 1)
set_color normal
printf ' in '
set_color $fish_color_cwd
printf '%s' (prompt_pwd)
set_color normal
# Line 2
echo
if test $VIRTUAL_ENV
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal)
end
printf '$ '
set_color normal
end
function fish_right_prompt
if test -d .git
printf '%s'(parse_git_branch)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment