From: JFSIII Date: Fri, 17 Jun 2011 23:45:21 +0000 (-0400) Subject: Convert themes and plugins to use the update colors. Themes are no longer burdened... X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=1b7c9419bf1a2474f2d819f9aa07687cb4d8fd1d;p=common%2Fbash_it.git Convert themes and plugins to use the update colors. Themes are no longer burdened with escaping the unprintable characters --- diff --git a/plugins/available/battery.plugin.bash b/plugins/available/battery.plugin.bash index 4946c2c..7c15812 100644 --- a/plugins/available/battery.plugin.bash +++ b/plugins/available/battery.plugin.bash @@ -69,11 +69,11 @@ battery_charge(){ local F_C='▸' # Depleted char local D_C='▹' - local DEPLETED_COLOR='\[${normal}\]' - local FULL_COLOR='\[${green}\]' - local HALF_COLOR='\[${yellow}\]' - local DANGER_COLOR='\[${red}\]' - local BATTERY_OUTPUT='${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}' + local DEPLETED_COLOR="${normal}" + local FULL_COLOR="${green}" + local HALF_COLOR="${yellow}" + local DANGER_COLOR="${red}" + local BATTERY_OUTPUT="${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}" local BATTERY_PERC=$(battery_percentage) case $BATTERY_PERC in @@ -123,7 +123,7 @@ battery_charge(){ echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" ;; *) - echo "${DANGER_COLOR}UNPLG\[${normal}\]" + echo "${DANGER_COLOR}UNPLG${normal}" ;; esac } diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index 8b48ddd..cb51fb8 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -4,15 +4,6 @@ SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" SCM_THEME_PROMPT_PREFIX=" |" SCM_THEME_PROMPT_SUFFIX="${green}|" - -# PROMPT="\[${bold_cyan}\]\[\$(scm_char)\]\[${green}\]\[\$(scm_prompt_info)\]\[${purple}\]\[\$(rvm_version_prompt)\] \[${yellow}\]\h \[${reset_color}\]in \[${green}\]\w \[${reset_color}\]\[\n\[${green}\]→\[${reset_color}\] " - - -PROMPT="\n\[${yellow}\]\[\$(rvm_version_prompt)\] \[${purple}\]\h \[${reset_color}\]in \[${green}\]\w\n\[${bold_cyan}\]\[\$(scm_char)\]\[${green}\]\[\$(scm_prompt_info)\] \[\[${green}\]→\[${reset_color}\] " - - - -# git theming GIT_THEME_PROMPT_DIRTY=" ${red}✗" GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" GIT_THEME_PROMPT_PREFIX=" ${green}|" @@ -21,3 +12,9 @@ GIT_THEME_PROMPT_SUFFIX="${green}|" RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" +function prompt_command() { + #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(rvm_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " + PS1="\n${yellow}$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/candy/candy.theme.bash b/themes/candy/candy.theme.bash index ef0ba26..64d31b8 100644 --- a/themes/candy/candy.theme.bash +++ b/themes/candy/candy.theme.bash @@ -1,2 +1,6 @@ #!/bin/bash -PROMPT="${green}\u@\h ${blue}\T ${reset_color}${white}\w${reset_color}\[\$(scm_prompt_info)\]${blue} →${bold_blue} \$${reset_color} " \ No newline at end of file +function prompt_command() { + PS1="${green}\u@\h ${blue}\T ${reset_color}${white}\w${reset_color}$(scm_prompt_info)\]${blue} →${bold_blue} ${reset_color} "; +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/clean/clean.theme.bash b/themes/clean/clean.theme.bash index 2fc418f..9998d65 100644 --- a/themes/clean/clean.theme.bash +++ b/themes/clean/clean.theme.bash @@ -1,9 +1,3 @@ -if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi - -PROMPT="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[\$(scm_prompt_info)\]$ " -RPROMPT='[\t]' - - # git theming ZSH_THEME_GIT_PROMPT_PREFIX="${bold_blue}(${yellow}%B" ZSH_THEME_GIT_PROMPT_SUFFIX="%b${bold_blue})${reset_color} " @@ -13,4 +7,14 @@ ZSH_THEME_GIT_PROMPT_DIRTY="${bold_red}✗" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' \ No newline at end of file +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' + +function prompt_command() { + + if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi + + PS1="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[\$(scm_prompt_info)\]$ " + RPROMPT='[\t]' +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/demula/demula.theme.bash b/themes/demula/demula.theme.bash index 0e6744a..bd48e12 100644 --- a/themes/demula/demula.theme.bash +++ b/themes/demula/demula.theme.bash @@ -33,22 +33,22 @@ #*color7: #E5E5E5 # ----------------------------------------------------------------- COLOR CONF -D_DEFAULT_COLOR='\[${normal}\]' -D_INTERMEDIATE_COLOR='\[${white}\]' -D_USER_COLOR='\[${purple}\]' -D_SUPERUSER_COLOR='\[${red}\]' -D_MACHINE_COLOR='\[${cyan}\]' -D_DIR_COLOR='\[${green}\]' -D_SCM_COLOR='\[${yellow}\]' -D_BRANCH_COLOR='\[${yellow}\]' -D_CHANGES_COLOR='\[${white}\]' -D_CMDFAIL_COLOR='\[${red}\]' -D_VIMSHELL_COLOR='\[${cyan}\]' +D_DEFAULT_COLOR="${normal}" +D_INTERMEDIATE_COLOR="${white}" +D_USER_COLOR="${purple}" +D_SUPERUSER_COLOR="${red}" +D_MACHINE_COLOR="${cyan}" +D_DIR_COLOR="${green}" +D_SCM_COLOR="${yellow}" +D_BRANCH_COLOR="${yellow}" +D_CHANGES_COLOR="${white}" +D_CMDFAIL_COLOR="${red}" +D_VIMSHELL_COLOR="${cyan}" # ------------------------------------------------------------------ FUNCTIONS case $TERM in xterm*) - TITLEBAR="\[\033]0;\w\007\]" + TITLEBAR="\033]0;\w\007" ;; *) TITLEBAR="" @@ -84,10 +84,10 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" # -------------------------------------------------------------- PROMPT OUTPUT prompt() { - local SAVE_CURSOR='\[\033[s\]' - local RESTORE_CURSOR='\[\033[u\]' - local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]' - local MOVE_CURSOR_5_LEFT='\[\033[5D\]' + local SAVE_CURSOR='\033[s' + local RESTORE_CURSOR='\033[u' + local MOVE_CURSOR_RIGHTMOST='\033[500C' + local MOVE_CURSOR_5_LEFT='\033[5D' if [ $(uname) = "Linux" ]; then diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 91844f0..1237f80 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -1,9 +1,9 @@ #!/bin/bash SCM_THEME_PROMPT_DIRTY='' SCM_THEME_PROMPT_CLEAN='' -SCM_GIT_CHAR='${bold_cyan}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_GIT_CHAR="${bold_cyan}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" RVM_THEME_PROMPT_PREFIX=" (" @@ -32,7 +32,7 @@ virtualenv_prompt() { fi } -prompt_setter() { +function prompt_setter() { # Save history history -a history -c @@ -44,8 +44,8 @@ prompt_setter() { clock=$THEME_PROMPT_CLOCK_FORMAT fi PS1=" -$clock $(scm_char) [\[$THEME_PROMPT_HOST_COLOR\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] $(virtualenv_prompt)\w -$(doubletime_scm_prompt)\[$reset_color\] $ " +$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)\w +$(doubletime_scm_prompt)$reset_color $ " PS2='> ' PS4='+ ' } diff --git a/themes/modern-t/modern-t.theme.bash b/themes/modern-t/modern-t.theme.bash index 55da6e1..12e5b04 100644 --- a/themes/modern-t/modern-t.theme.bash +++ b/themes/modern-t/modern-t.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" case $TERM in xterm*) diff --git a/themes/modern/modern.theme.bash b/themes/modern/modern.theme.bash index 3efe9ff..32c7cab 100644 --- a/themes/modern/modern.theme.bash +++ b/themes/modern/modern.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" case $TERM in xterm*) diff --git a/themes/n0qorg/n0qorg.theme.bash b/themes/n0qorg/n0qorg.theme.bash index fcaca43..2b9def6 100644 --- a/themes/n0qorg/n0qorg.theme.bash +++ b/themes/n0qorg/n0qorg.theme.bash @@ -5,7 +5,11 @@ # host directory (branch*)» # for example: # ananas ~/Code/bash-it/themes (master*)» -PROMPT="${bold_blue}\[\$(hostname)\]${normal} \w${normal} ${bold_white}\[\$(git_prompt_info)\]${normal}» " +function prompt_command() { + PS1="${bold_blue}[$(hostname)]${normal} \w${normal} ${bold_white}[$(git_prompt_info)]${normal}» " +} + +PROMPT_COMMAND=prompt_command; ## git-theme # feel free to change git chars. diff --git a/themes/pete/pete.theme.bash b/themes/pete/pete.theme.bash index 95f243a..7b6702c 100644 --- a/themes/pete/pete.theme.bash +++ b/themes/pete/pete.theme.bash @@ -5,7 +5,7 @@ prompt_setter() { history -a history -c history -r - PS1="(\t) $(scm_char) [\[$blue\]\u\[$reset_color\]@\[$green\]\H\[$reset_color\]] \[$yellow\]\w\[$reset_color\]$(scm_prompt_info)$(rvm_version_prompt) $\[$reset_color\] " + PS1="(\t) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(rvm_version_prompt) $reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/sirup/sirup.theme.bash b/themes/sirup/sirup.theme.bash index 5066587..146cc35 100644 --- a/themes/sirup/sirup.theme.bash +++ b/themes/sirup/sirup.theme.bash @@ -13,6 +13,10 @@ function rvm_version_prompt { [ "$full" != "" ] && echo "$full" } + +function prompt_command() { + # Check http://github.com/Sirupsen/dotfiles for screenshot + PS1="$blue\W/$bold_blue$(rvm_version_prompt)$bold_green$(__git_ps1 " (%s)") ${normal}$ " +} -# Check http://github.com/Sirupsen/dotfiles for screenshot -PS1='\[$blue\]\W/\[$bold_blue\]$(rvm_version_prompt)\[$bold_green\]$(__git_ps1 " (%s)") \[${normal}\]$ ' +PROMPT_COMMAND=prompt_command; diff --git a/themes/standard/standard.theme.bash b/themes/standard/standard.theme.bash index 5ba288c..87402c7 100644 --- a/themes/standard/standard.theme.bash +++ b/themes/standard/standard.theme.bash @@ -1,7 +1,3 @@ -PROMPT='\[${green}\]\u\[${normal}\]@\[${green}\]\h\[${normal}\]:\[${blue}\]\w\[${normal}\]\[${red}\]$(prompt_char)$(git_prompt_info)\[${normal}\]\$ ' - - - # scm themeing SCM_THEME_PROMPT_DIRTY="×" SCM_THEME_PROMPT_CLEAN="✓" @@ -19,4 +15,10 @@ case $TERM in *) TITLEBAR="" ;; -esac \ No newline at end of file +esac + +function prompt_command() { + PROMPT='${green}\u${normal}@${green}\h${normal}:${blue}\w${normal}${red}$(prompt_char)$(git_prompt_info)${normal}\$ ' +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/zitron/zitron.theme.bash b/themes/zitron/zitron.theme.bash index c072686..3ec4d97 100644 --- a/themes/zitron/zitron.theme.bash +++ b/themes/zitron/zitron.theme.bash @@ -1,12 +1,6 @@ #!/bin/bash # zitron theme by Florian Baumann -## look-a-like -# user:host:pwd git-branch(*)$ -# for example: -# noqqe:deathstar:themes master*$ -PROMPT="${no_color}\u:\[\$(hostname)\]${normal}:${bold_yellow}\W/${normal} \[\$(git_prompt_info)\]${reset_color}$ " - ## git-theme # feel free to change git chars. GIT_THEME_PROMPT_DIRTY="${bold_yellow}*${normal}" @@ -18,3 +12,13 @@ GIT_THEME_PROMPT_SUFFIX="" # thanks a lot to http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" export LS_COLORS="no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;34:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:" + +function prompt_command() { + ## look-a-like + # user:host:pwd git-branch(*)$ + # for example: + # noqqe:deathstar:themes master*$ + PS1="${no_color}\u:$(hostname)${normal}:${bold_yellow}\W/${normal} $(git_prompt_info)${reset_color}$ " +} + +PROMPT_COMMAND=prompt_command; diff --git a/themes/zork/zork.theme.bash b/themes/zork/zork.theme.bash index 54615d7..f541c0d 100644 --- a/themes/zork/zork.theme.bash +++ b/themes/zork/zork.theme.bash @@ -1,11 +1,11 @@ SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_SUFFIX="" -SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}' -SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}' -SCM_GIT_CHAR='${bold_green}±${normal}' -SCM_SVN_CHAR='${bold_cyan}⑆${normal}' -SCM_HG_CHAR='${bold_red}☿${normal}' +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" #Mysql Prompt export MYSQL_PS1="(\u@\h) [\d]> "