pull/36/merge
GitHub Merge Button 2011-12-19 10:34:34 -08:00
commit 099035d0cf
4 changed files with 54 additions and 43 deletions

View File

@ -109,6 +109,20 @@ function hg_prompt_vars {
SCM_CHANGE=$(hg summary 2> /dev/null | grep parent | awk '{print $2}') SCM_CHANGE=$(hg summary 2> /dev/null | grep parent | awk '{print $2}')
} }
function hg_prompt_info() {
if [[ -n $(hg status 2> /dev/null) ]]; then
state=${HG_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else
state=${HG_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
fi
prefix=${HG_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
suffix=${HG_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
branch=$(hg summary 2> /dev/null | grep branch | awk '{print $2}')
changeset=$(hg summary 2> /dev/null | grep parent | awk '{print $2}')
echo -e "$prefix$branch:${changeset#*:}$state$suffix"
}
function rvm_version_prompt { function rvm_version_prompt {
if which rvm &> /dev/null; then if which rvm &> /dev/null; then
rvm=$(rvm tools identifier) || return rvm=$(rvm tools identifier) || return

View File

@ -1,44 +1,44 @@
#!/bin/bash #!/bin/bash
black="\[\e[0;30m\]" black='\[\e[0;30m\]'
red="\[\e[0;31m\]" red='\[\e[0;31m\]'
green="\[\e[0;32m\]" green='\[\e[0;32m\]'
yellow="\[\e[0;33m\]" yellow='\[\e[0;33m\]'
blue="\[\e[0;34m\]" blue='\[\e[0;34m\]'
purple="\[\e[0;35m\]" purple='\[\e[0;35m\]'
cyan="\[\e[0;36m\]" cyan='\[\e[0;36m\]'
white="\[\e[1;37m\]" white='\[\e[1;37m\]'
orange="\[\e[33;40m\]" orange='\[\e[33;40m\]'
bold_black="\[\e[1;30m\]" bold_black='\[\e[1;30m\]'
bold_red="\[\e[1;31m\]" bold_red='\[\e[1;31m\]'
bold_green="\[\e[1;32m\]" bold_green='\[\e[1;32m\]'
bold_yellow="\[\e[1;33m\]" bold_yellow='\[\e[1;33m\]'
bold_blue="\[\e[1;34m\]" bold_blue='\[\e[1;34m\]'
bold_purple="\[\e[1;35m\]" bold_purple='\[\e[1;35m\]'
bold_cyan="\[\e[1;36m\]" bold_cyan='\[\e[1;36m\]'
bold_white="\[\e[1;37m\]" bold_white='\[\e[1;37m\]'
bold_orange="\[\e[1;33;40m\]" bold_orange='\[\e[1;33;40m\]'
underline_black="\[\e[4;30m\]" underline_black='\[\e[4;30m\]'
underline_red="\[\e[4;31m\]" underline_red='\[\e[4;31m\]'
underline_green="\[\e[4;32m\]" underline_green='\[\e[4;32m\]'
underline_yellow="\[\e[4;33m\]" underline_yellow='\[\e[4;33m\]'
underline_blue="\[\e[4;34m\]" underline_blue='\[\e[4;34m\]'
underline_purple="\[\e[4;35m\]" underline_purple='\[\e[4;35m\]'
underline_cyan="\[\e[4;36m\]" underline_cyan='\[\e[4;36m\]'
underline_white="\[\e[4;37m\]" underline_white='\[\e[4;37m\]'
underline_orange="\[\e[4;33;40m\]" underline_orange='\[\e[4;33;40m\]'
background_black="\[\e[40m\]" background_black='\[\e[40m\]'
background_red="\[\e[41m\]" background_red='\[\e[41m\]'
background_green="\[\e[42m\]" background_green='\[\e[42m\]'
background_yellow="\[\e[43m\]" background_yellow='\[\e[43m\]'
background_blue="\[\e[44m\]" background_blue='\[\e[44m\]'
background_purple="\[\e[45m\]" background_purple='\[\e[45m\]'
background_cyan="\[\e[46m\]" background_cyan='\[\e[46m\]'
background_white="\[\e[47m\]" background_white='\[\e[47m\]'
normal="\[\e[00m\]" normal='\[\e[00m\]'
reset_color="\[\e[39m\]" reset_color='\[\e[39m\]'

View File

@ -41,7 +41,7 @@ prompt() {
# Yes, the indenting on these is weird, but it has to be like # Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly. # this otherwise it won't display properly.
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) PS1="${bold_red}┌─${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} " ${bold_red}└─▪${normal} "
else else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell)

View File

@ -11,11 +11,8 @@ case $TERM in
TITLEBAR="" TITLEBAR=""
;; ;;
esac esac
PROMPT="${TITLEBAR}${orange}${reset_color}${green}\w${bold_blue}\[\$(scm_prompt_info)\]${reset_color} " PROMPT="${TITLEBAR}${bold_green}\w${reset_color}${bold_blue}\$(scm_prompt_info)${reset_color} "
# scm theming
# scm themeing
SCM_THEME_PROMPT_DIRTY=" ✗"
SCM_THEME_PROMPT_CLEAN=" ✓"
SCM_THEME_PROMPT_PREFIX="(" SCM_THEME_PROMPT_PREFIX="("
SCM_THEME_PROMPT_SUFFIX=")" SCM_THEME_PROMPT_SUFFIX=")"