Created
June 12, 2014 13:44
-
-
Save JodiWarren/083c185c829722425fa8 to your computer and use it in GitHub Desktop.
Fish Prompt
This file contains 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
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