Skip to content

Instantly share code, notes, and snippets.

@jedahan
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedahan/93c4e7f9282160b8b73d to your computer and use it in GitHub Desktop.
Save jedahan/93c4e7f9282160b8b73d to your computer and use it in GitHub Desktop.
precmd for seeing if we should show push or pull arrows in the prompt
command git rev-parse --abbrev-ref @'{u}' &>/dev/null && {
local arrows=""
(( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows="⇡"
(( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+="⇣"
print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment