Skip to content

Instantly share code, notes, and snippets.

@hvdklauw
Created December 4, 2013 13:38
Show Gist options
  • Save hvdklauw/7787520 to your computer and use it in GitHub Desktop.
Save hvdklauw/7787520 to your computer and use it in GitHub Desktop.
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_branch yellow
set __fish_git_prompt_showuntrackedfiles 'yes'
# Status Chars
set __fish_git_prompt_char_dirtystate '⚡'
set __fish_git_prompt_char_stagedstate '→'
set __fish_git_prompt_char_stashstate '↩'
set __fish_git_prompt_char_upstream_ahead '↑'
set __fish_git_prompt_char_upstream_behind '↓'
set -l magenta (set_color magenta)
set -l white (set_color white)
set -l normal (set_color normal)
set -l yellow (set_color yellow)
set -l lightgreen (set_color green --bold)
set -l green (set_color green)
set -l grey (set_color black --bold)
set -l _hg_prompt_branch "< on $magenta<branch>$normal>"
set -l _hg_prompt_tags "< at $yellow<tags|$normal, $yellow>$normal>"
set -l _hg_prompt_status "$lightgreen<status|modified|unknown><update>$normal"
set -l _hg_prompt_queue "<$green Q:<queue>$normal >"
set -l _hg_prompt_patches "<patches|join( → )|pre_applied($yellow)|post_applied($white)|pre_unapplied($grey)|post_unapplied($white)>"
set -g _hg_prompt_all "$_hg_prompt_branch$_hg_prompt_status$_hg_prompt_tags$_hg_prompt_queue$_hg_prompt_patches"
function hg_prompt
hg prompt --angle-brackets "$_hg_prompt_all" 2>/dev/null
end
function virtualenv_prompt
if set -q VIRTUAL_ENV
echo -n -s (set_color yellow --bold) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " "
end
end
function fish_prompt
set last_status $status
emit prompt
printf "\n"
printf "%s%s%s:%s%s%s:%s%s%s " (set_color red) (date "+%H") (set_color normal) (set_color red) (date "+%M") (set_color normal) (set_color red) (date "+%S") (set_color normal)
printf "%s%s%s " (set_color magenta) (whoami) (set_color normal)
#Hostname removed: printf "at %s%s%s " (set_color yellow) (hostname|cut -d . -f 1) (set_color normal)
virtualenv_prompt
set -l cwd (prompt_pwd)
if test -z $cwd
set cwd "/"
end
printf "in %s$cwd%s" (set_color green) (set_color normal)
echo
if test $last_status -eq 0
set_color white -o
printf '» '
else
set_color red -o
printf '[%d] » ' $last_status
end
set_color normal
end
function fish_right_prompt
printf "%s" (hg_prompt)
printf "%s" (__fish_git_prompt)
set_color normal
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment