1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

25697: drop git code and switch to vcs_info.

This commit is contained in:
Clint Adams 2008-09-21 12:42:36 +00:00
parent 90c33894c4
commit 1870a858ea
2 changed files with 11 additions and 5 deletions

View file

@ -15,6 +15,8 @@ prompt_clint_setup () {
local -A pc
local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end p_win
autoload -Uz vcs_info
pcc[1]=${1:-'red'}
pcc[2]=${2:-'cyan'}
pcc[3]=${3:-'green'}
@ -36,7 +38,7 @@ prompt_clint_setup () {
[[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']"
p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']"
p_git="%(2v.-%U%2v%u-.)"
p_vcs="%(2v.%U%2v%u.)"
p_shlvlhist="%fzsh%(2L./$SHLVL.) %B%h%b "
p_rc="%(?..[%?%1v] )"
@ -46,7 +48,7 @@ prompt_clint_setup () {
prompt="$p_date$p_tty$p_plat$p_ver
$p_userpwd
$p_shlvlhist$p_rc$p_git$p_end"
$p_shlvlhist$p_rc$p_vcs$p_end"
PS2='%(4_.\.)%3_> %E'
add-zsh-hook precmd prompt_clint_precmd
@ -63,9 +65,8 @@ prompt_clint_precmd () {
[[ -o interactive ]] && jobs -l
git_dir=$(git-rev-parse --git-dir 2> /dev/null) || return
git_ref=$(git-symbolic-ref HEAD 2> /dev/null) || git_ref="(no branch)"
psvar[2]=${git_ref#refs/heads/}
vcs_info
[[ -n $vcs_info_msg_0_ ]] && psvar[2]="$vcs_info_msg_0_"
}
prompt_clint_setup "$@"