summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-07 15:27:11 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-06-07 15:27:11 +0200
commit386a54753601871d04a1934cf1379bdb9a60e55d (patch)
treea8dd77d5c8a06e711d40810d1f2411007bdc3c6a /12_Prompts.zsh
parent1697c66240bc9d7b85e50f500ac6704f8e69bf33 (diff)
[Prompts] Lightens up the preexec, with better prompt_date update
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh27
1 files changed, 15 insertions, 12 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index ab0711b..8f0ddec 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -104,17 +104,14 @@ preexec ()
{
__term_title "$2"
- _prompt_colors[date]=$_date_colors[exec]
- __set_prompt_date x
- _prompt_colors[date]=$_date_colors[normal]
- __hbar
- __redefine_prompt
+ __set_prompt_date exec
- tput sc
- __up_up
# Only redraws the date, not the full prompt, since we got glitches with BANG_HIST and AUTOCORRECT...
- print -Pn $(tput cub $COLUMNS ; tput cuf $(($COLUMNS - $DATESIZE)))$C_$_prompt_colors[bar]$_C$DATE
- tput rc
+ tput sc # save cursor position
+ __up_up # go to start of current prompt
+ print -Pn "$(__show_date)" # prints date
+ tput rc # restore cursor position
+
print -Pn "$C_$_prompt_colors[exec]$_C"
}
@@ -311,6 +308,11 @@ __yeah_prompt ()
PS1=$C_$prompt_color[default]$_C$C_$_prompt_colors[user]$_C"%n"$C_$_prompt_colors[arob]$_C"@"$C_$_prompt_colors[host]$_C"%m "$CURDIR" "$C_$_prompt_colors[dies]$_C">"$C_$_prompt_colors[cmd]$_C" "
}
+__show_date()
+{
+ echo $(tput cub $COLUMNS ; tput cuf $(($COLUMNS - $DATESIZE)))$DATE
+}
+
__two_lines_prompt ()
{
## Le prompt le plus magnifique du monde, et c'est le mien !
@@ -322,7 +324,9 @@ __two_lines_prompt ()
result=$($trigger)
[ -n "$result" ] && PS1+=$(tput cuf 1)${result}$C_$_prompt_colors[bar]$_C
done
- PS1+=$(tput cub $COLUMNS ; tput cuf $(($COLUMNS - $DATESIZE)))$C_$_prompt_colors[bar]$_C$DATE
+
+ PS1+=$(__show_date)
+
PS1+="
"$C_$prompt_color[default]$_C$C_$_prompt_colors[user]$_C"%n"$C_$_prompt_colors[arob]$_C"@"$C_$_prompt_colors[host]$_C"%M"$C_$_prompt_colors[display]$_C"${DISPLAY:+($DISPLAY)} "$CURDIR$VCSBRANCH
for trigger in $PS1_EXTRA_INFO
@@ -363,12 +367,11 @@ fi
precmd()
{
- # this MUST BE the real first operation else we lose the error code...
+ # Catchs ERROR code
ERROR=$(print -Pn "%(?;;%?)")
__update_prompt_elements
__redefine_prompt
- #print -Pn "\r"
}