From 95b1193125bf2e9cd5682638a2adb27b270799b2 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Tue, 26 Aug 2008 16:32:18 +0200 Subject: [PATCH 1/1] zshrc: Load colors earlier, for vcs_info() This also adds YELLOW and MAGENTA to the prompt color variables. --- etc/zsh/zshrc | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 7a5f2f3..6de5c64 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1010,6 +1010,29 @@ if [[ -n "$BATTERY" ]] ; then fi # }}} +# set colors for use in prompts {{{ +if zrcautoload colors && colors 2>/dev/null ; then + BLUE="%{${fg[blue]}%}" + RED="%{${fg_bold[red]}%}" + GREEN="%{${fg[green]}%}" + CYAN="%{${fg[cyan]}%}" + MAGENTA="%{${fg[magenta]}%}" + YELLOW="%{${fg[yellow]}%}" + WHITE="%{${fg[white]}%}" + NO_COLOUR="%{${reset_color}%}" +else + BLUE=$'%{\e[1;34m%}' + RED=$'%{\e[1;31m%}' + GREEN=$'%{\e[1;32m%}' + CYAN=$'%{\e[1;36m%}' + WHITE=$'%{\e[1;37m%}' + MAGENTA='%{\e[1;35m%}' + YELLOW='%{\e[1;33m%}' + NO_COLOUR=$'%{\e[0m%}' +fi + +# }}} + # gather version control information for inclusion in a prompt {{{ # vcs_info() documentation: {{{ @@ -1315,10 +1338,8 @@ if [[ "$TERM" == dumb ]] ; then zstyle ':vcs_info:*' promptformat "(%s%)-[%b] " else # these are the same, just with a lot of colours: - zstyle ':vcs_info:*' promptactionformat \ -"%{${fg[magenta]}%}(%{${reset_color}%}%s%{${fg[magenta]}%})%{${fg[yellow]}%}-%{${fg[magenta]}%}[%{${fg[green]}%}%b%{${fg[yellow]}%}|%{${fg[red]}%}%a%{${fg[magenta]}%}]%{${reset_color}%} " - zstyle ':vcs_info:*' promptformat \ -"%{${fg[magenta]}%}(%{${reset_color}%}%s%{${fg[magenta]}%})%{${fg[yellow]}%}-%{${fg[magenta]}%}[%{${fg[green]}%}%b%{${fg[magenta]}%}]%{${reset_color}%} " + zstyle ':vcs_info:*' promptactionformat "${MAGENTA}(${NO_COLOUR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${YELLOW}|${RED}%a${MAGENTA}]${NO_COLOUR} " + zstyle ':vcs_info:*' promptformat "${MAGENTA}(${NO_COLOUR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${MAGENTA}]${NO_COLOUR}%} " fi # }}} @@ -1397,23 +1418,6 @@ preexec () { esac } -# set colors -if zrcautoload colors && colors 2>/dev/null ; then - BLUE="%{${fg[blue]}%}" - RED="%{${fg_bold[red]}%}" - GREEN="%{${fg[green]}%}" - CYAN="%{${fg[cyan]}%}" - WHITE="%{${fg[white]}%}" - NO_COLOUR="%{${reset_color}%}" -else - BLUE=$'%{\e[1;34m%}' - RED=$'%{\e[1;31m%}' - GREEN=$'%{\e[1;32m%}' - CYAN=$'%{\e[1;36m%}' - WHITE=$'%{\e[1;37m%}' - NO_COLOUR=$'%{\e[0m%}' -fi - EXITCODE="%(?..%?%1v )" PS2='`%_> ' # secondary prompt, printed when the shell needs more information to complete a command. PS3='?# ' # selection prompt used within a select loop. -- 2.1.4