Add safe vcprompt use to demula theme and monokai colors. Update default template to include vcprompt path.

pull/41/head
Jesus de Mula Cano 2011-03-06 18:49:08 +01:00
parent 9681bae634
commit 0127dc2dc7
2 changed files with 35 additions and 10 deletions

View File

@ -50,5 +50,9 @@ export TODO="t"
# Set store directory for handmade commandline history tool # Set store directory for handmade commandline history tool
export hchtstoredir="$HOME/.hcht" export hchtstoredir="$HOME/.hcht"
# Set vcprompt executable path for scm advance info in prompt (demula theme)
# https://github.com/xvzf/vcprompt
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
# Load Bash It # Load Bash It
source $BASH/bash_it.sh source $BASH/bash_it.sh

View File

@ -5,7 +5,31 @@
# - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/ # - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/
# - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ # - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
# - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ # - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/
# - Docs of Bash - http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html # - Bash_it modern theme
#
# by Jesus de Mula <jesus@demula.name>
# For the real Monokai colors you should add these to your .XDefaults or
# terminal configuration:
#! ----------------------------------------------------------- TERMINAL COLORS
#! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
#*background: #272822
#*foreground: #E2DA6E
#*color0: black
#! mild red
#*color1: #CD0000
#! light green
#*color2: #A5E02D
#! orange (yellow)
#*color3: #FB951F
#! "dark" blue
#*color4: #076BCC
#! hot pink
#*color5: #F6266C
#! cyan
#*color6: #64D9ED
#! gray
#*color7: #E5E5E5
# ----------------------------------------------------------------- COLOR CONF # ----------------------------------------------------------------- COLOR CONF
D_DEFAULT_COLOR='\[${normal}\]' D_DEFAULT_COLOR='\[${normal}\]'
@ -19,6 +43,7 @@ D_BRANCH_COLOR='\[${yellow}\]'
D_CHANGES_COLOR='\[${white}\]' D_CHANGES_COLOR='\[${white}\]'
D_CMDFAIL_COLOR='\[${red}\]' D_CMDFAIL_COLOR='\[${red}\]'
D_VIMSHELL_COLOR='\[${cyan}\]' D_VIMSHELL_COLOR='\[${cyan}\]'
# ------------------------------------------------------------------ FUNCTIONS # ------------------------------------------------------------------ FUNCTIONS
case $TERM in case $TERM in
xterm*) xterm*)
@ -54,25 +79,21 @@ $code ${D_DEFAULT_COLOR}"
} }
# vcprompt for scm instead of bash_it default # vcprompt for scm instead of bash_it default
# https://github.com/xvzf/vcprompt
demula_vcprompt() { demula_vcprompt() {
local D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt if [ ! -z "$VCPROMPT_EXECUTABLE" ]
then
local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\
${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
local D_VCPROMPT_OUTPUT=$($D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT") $VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT"
fi
echo $D_VCPROMPT_OUTPUT
} }
# -------------------------------------------------------------- PROMPT OUTPUT # -------------------------------------------------------------- PROMPT OUTPUT
prompt() { prompt() {
local SAVE_CURSOR='\[\033[s\]' local SAVE_CURSOR='\[\033[s\]'
local RESTORE_CURSOR='\[\033[u\]' local RESTORE_CURSOR='\[\033[u\]'
local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]'
local MOVE_CURSOR_LEFTMOST='\[\033[500D\]'
local MOVE_CURSOR_5_LEFT='\[\033[5D\]' local MOVE_CURSOR_5_LEFT='\[\033[5D\]'
local MOVE_CURSOR_1_DOWN='\[\033[1B\]'
PS1="${TITLEBAR}\n\ PS1="${TITLEBAR}\n\
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\