From fe219a362b456de4f94c96e746e5b8955e81312d Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Sat, 13 Oct 2007 13:33:04 +0000 Subject: 23947: remove apm battery status and add git branch detection. --- Functions/Prompts/prompt_clint_setup | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'Functions/Prompts') diff --git a/Functions/Prompts/prompt_clint_setup b/Functions/Prompts/prompt_clint_setup index d9fbacc9a..6cf76db72 100644 --- a/Functions/Prompts/prompt_clint_setup +++ b/Functions/Prompts/prompt_clint_setup @@ -36,7 +36,7 @@ prompt_clint_setup () { [[ -n "$WINDOW" ]] && p_win="$pc['\(']%{$fg_bold[$pcc[4]]%}$WINDOW$pc['\)']" p_userpwd="$pc['<']%{$fg_no_bold[$pcc[3]]%}%n@%m$p_win%{$fg_bold[$pcc[5]]%}:%{$fg_no_bold[$pcc[4]]%}%~$pc['>']" - [[ -f /proc/apm ]] && p_apm="%(2v.-%2v-.)" + p_git="%(2v.-%U%2v%u-.)" p_shlvlhist="%{$reset_color%}zsh%(2L./$SHLVL.) %B%h%b " p_rc="%(?..[%?%1v] )" @@ -46,34 +46,28 @@ prompt_clint_setup () { prompt="$p_date$p_tty$p_plat$p_ver $p_userpwd -$p_shlvlhist$p_rc$p_apm$p_end" +$p_shlvlhist$p_rc$p_git$p_end" PS2='%(4_.\.)%3_> %E' - [[ -f /proc/apm ]] && - precmd () { prompt_clint_precmd ; prompt_clint_apm_precmd } || - precmd () { prompt_clint_precmd } + precmd () { prompt_clint_precmd } preexec () { } } prompt_clint_precmd () { setopt noxtrace noksharrays localoptions local exitstatus=$? + local git_dir git_ref + psvar=() [[ $exitstatus -ge 128 ]] && psvar[1]=" $signals[$exitstatus-127]" || psvar[1]="" [[ -o interactive ]] && jobs -l -} - -prompt_clint_apm_precmd () { - setopt noxtrace noksharrays localoptions - local bat ac - - bat=${${="$( /dev/null) || return + git_ref=$(git-symbolic-ref HEAD 2> /dev/null) || git_ref="(no branch)" + psvar[2]=${ref#refs/heads/} - [[ $bat == ("100%"|"-1%") ]] && psvar[2]=() || psvar[2]="$ac$bat" } prompt_clint_setup "$@" -- cgit 1.4.1