Skip to content

Instantly share code, notes, and snippets.

@marshally
Forked from gdagley/geof.theme.bash
Created February 7, 2013 08:15
Show Gist options
  • Save marshally/4729404 to your computer and use it in GitHub Desktop.
Save marshally/4729404 to your computer and use it in GitHub Desktop.
#!/bin/bash
# prompt themeing
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
# Checks if there are commits ahead from remote
function git_prompt_ahead() {
if [[ -n $(git log origin/$(current_branch)...HEAD --right-only 2> /dev/null | grep '^commit') ]]; then
echo -e "$SCM_THEME_PROMPT_AHEAD"
fi
}
# Checks if there are commits available from remote
function git_prompt_behind() {
if [[ -n $(git log origin/$(current_branch)...HEAD --left-only 2> /dev/null | grep '^commit') ]]; then
echo -e "$SCM_THEME_PROMPT_BEHIND"
fi
}
#added TITLEBAR for updating the tab and window titles with the pwd
case $TERM in
xterm*)
TITLEBAR="\[\033]0;\w\007\]"
;;
*)
TITLEBAR=""
;;
esac
PROMPT="${TITLEBAR}${red}\$(rvm_version_prompt) ${green}\w ${yellow}\$(scm_prompt_info) \$(git_prompt_ahead)\$(git_prompt_behind)${normal} "
# scm themeing
SCM_THEME_PROMPT_DIRTY=" ✗"
SCM_THEME_PROMPT_CLEAN=" ✓"
SCM_THEME_PROMPT_PREFIX="("
SCM_THEME_PROMPT_SUFFIX=")"
SCM_THEME_PROMPT_AHEAD="↑"
SCM_THEME_PROMPT_BEHIND="↓"
RVM_THEME_PROMPT_PREFIX="|"
RVM_THEME_PROMPT_SUFFIX="|"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment