From 728acf08bb0b5d61b4c89ec27c8192c8feacce20 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 28 Mar 2013 11:50:15 +0100 Subject: [DEBUG] Get this fucking prompt blackhole ... --- 01_Internal.zsh | 20 ++++++++++++++++++++ 12_Prompts.zsh | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/01_Internal.zsh b/01_Internal.zsh index a4bdf43..e0b543f 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -140,6 +140,8 @@ __get_git_branch () { local my_git_branch checkouted_branch="yes" + __debug + __debug -n " repo..." if [ -f ".repo/manifests.git/config" ] then my_git_branch=$(grep merge .repo/manifests.git/config | awk '{print $3}') @@ -149,7 +151,9 @@ __get_git_branch () return fi fi + __debug + __debug -n " branch..." # Get git branch only from git managed folders (not ignored subfolders..) [ "$( ( git ls-files ; git ls-tree HEAD . ) 2>&- | head -n1)" = "" -a \( ! -d .git -o "$(git rev-parse --git-dir 2>&-)" != ".git" \) -a "$(git rev-parse --is-inside-git-dir 2>&-)" != "true" ] && return @@ -179,9 +183,11 @@ __get_git_branch () my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))" fi fi + __debug my_git_branch="→"$my_git_branch"←" + __debug -n " rebase..." # Rebase in progress ? if [ -d $GIT_DIR/rebase-merge -o -d $GIT_DIR/rebase-apply ] then @@ -211,7 +217,9 @@ __get_git_branch () # No rebase in progress, put '(' ')' if needed [ ! "$checkouted_branch" ] && my_git_branch="($my_git_branch)" fi + __debug + __debug -n " stashes..." # Show number of stashed commits by appending '+' signs for each if [ "$(git rev-parse --is-inside-git-dir)" != "true" -a "$(git config --get core.bare)" != "true" ] then @@ -237,6 +245,8 @@ __get_guilt_series () # guilt="" + __debug -n " Guilt" + if ( __cmd_exists guilt && guilt status >/dev/null 2>&- ) then applied=$(guilt applied 2>/dev/null | wc -l) @@ -258,6 +268,7 @@ __get_guilt_series () guilt=$guilt$C_$colors[none]$_C fi fi + __debug echo $guilt } @@ -276,6 +287,8 @@ __get_git_status () my_git_status=$_gcl_colors[uptodate]; + __debug -n " where to..." + if [ -f ".repo/manifests.git/config" ] then echo $my_git_status @@ -294,6 +307,9 @@ __get_git_status () changed="yes" fi + __debug + + __debug -n " cached/changed..." GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) if [ "$cached" != "" -a "$changed" != "" ] @@ -314,6 +330,9 @@ __get_git_status () fi fi + __debug + + __debug -n " stashes..." if [ $(git status | sed -n '2{/can be fast-forwarded/p;/have diverged/p};3q' | wc -l) -gt 0 ] then my_git_status+=";$_gcl_colors[ffwd]" @@ -325,6 +344,7 @@ __get_git_status () fi echo $my_git_status + __debug } __zsh_status () diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 92c986a..2d9ce0e 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -286,7 +286,9 @@ PS1_TASKBAR+=(__display) __display_vi_mode() { + __debug -n " vimode..." echo -n "$C_$color[bold];33$_C%8v" + __debug } PS1_TASKBAR+=(__display_vi_mode) @@ -296,26 +298,34 @@ __two_lines_prompt () # Affiche l'user, l'host, le tty et le pwd. Rien que ça... # PS1_=$(print -Pn '\r')$HBAR$(print -Pn '\r') + __debug "-----------------> taskbar..." for trigger in $PS1_TASKBAR do + __debug " ---> $trigger..." result=$($trigger) [ -n "$result" ] && PS1_+=$_cuf1_${result}$C_$_prompt_colors[bar]$_C done + __debug "-----------------> date..." PS1_+=$(__show_date) + __debug "-----------------> extra..." PS1_+=" "$C_$prompt_color[default]$_C$C_$_prompt_colors[user]$_C"%n"$C_$_prompt_colors[arob]$_C"@"$C_$_prompt_colors[host]$_C"%M "$CURDIR${VCSBRANCH:+ $VCSBRANCH} for trigger in $PS1_EXTRA_INFO do + __debug " ---> $trigger..." result=$($trigger) [ -n "$result" ] && PS1_+=" "${result} done + __debug "-----------------> PS1..." PS1=$PS1_" "$C_$_prompt_colors[dies]$_C"%#"$C_$_prompt_colors[cmd]$_C" " + __debug "-----------------> PS2..." local lastline="$(__expand_text $PS1 | tail -n1)" # Prompt level 2 PS2="$C_$_prompt_colors[soft_generic]$_C$(for i in {2..$#lastline} ; print -n "·" ; tput sc ; print -n "\r")$C_$color[yellow];$color[bold]$_C%_$(tput rc)$C_$color[none]$_C " + __debug "------------------------------" } -- cgit v1.2.3