From 0c31698701b35f9d9b2ff7d5efd9ae9ce0b217f5 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 2 Apr 2008 14:41:38 +0200 Subject: Debug dans la fonction precmd() --- 12_Prompts.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to '12_Prompts.zsh') diff --git a/12_Prompts.zsh b/12_Prompts.zsh index a5b7348..c8c0eca 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -56,22 +56,31 @@ old_precmd() { # Error error=$(print -Pn "%(?;;-%?)") + [ "$DEBUG" = "yes" ] && echo -n " Error code..." ERRORSIZE=${#error} ERROR="%(?;;"$C_$prompt_colors[bar]$_C"-"$C_$prompt_colors[error]$_C"%?)" + [ "$DEBUG" = "yes" ] && echo + [ "$DEBUG" = "yes" ] && echo -n " Term title..." # Flush the term title term_title + [ "$DEBUG" = "yes" ] && echo # Date + [ "$DEBUG" = "yes" ] && echo -n " Date..." DATE=$C_$prompt_colors[braces]$_C"[ "$C_$prompt_colors[date]$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$prompt_colors[braces]$_C" ]"$C_$prompt_colors[bar]$_C"-" DATEEXPAND=$(expand_text "$DATE") DATESIZE=${#DATEEXPAND} + [ "$DEBUG" = "yes" ] && echo # Mailcheck + [ "$DEBUG" = "yes" ] && echo -n " Mails..." MAILSTAT=$(eval echo "`[ -s ~/.procmail/procmail.log ] && < ~/.procmail/procmail.log awk 'BEGIN {RS="From" ; HAM=-1 ; LISTES=0 } !/JUNK/ { HAM++ } /Listes|Newsletters|Notifications/ { LISTES++ } END { if ((HAM - LISTES) > 0) { print "$C_$prompt_colors[bar]$_C""-""$C_$mail_colors[unread]$_C""@" } else if (LISTES > 0) { print "$C_$prompt_colors[bar]$_C""-""$C_$mail_colors[listes]$_C""@" } }'`") MAILSTATEXPAND=$(expand_text "$MAILSTAT") MAILSTATSIZE=${#MAILSTATEXPAND} + [ "$DEBUG" = "yes" ] && echo + [ "$DEBUG" = "yes" ] && echo -n " Horizontal bar..." # First line of prompt, calculation of the remaining place spaceleft=$((1 + $COLUMNS - $ERRORSIZE - $MAILSTATSIZE - $DATESIZE)) @@ -80,6 +89,7 @@ old_precmd() do HBAR=$HBAR- done + [ "$DEBUG" = "yes" ] && echo ## ## Second line of prompt : don't let the path garbage the entire line @@ -87,6 +97,7 @@ old_precmd() # get svn status # + [ "$DEBUG" = "yes" ] && echo -n " SVN status..." SVNREV=$(LC_ALL=C svn info 2>&- $PWD | awk '/^Revision: / {print $2}') SVNREVSIZE=${#${SVNREV:+:r$SVNREV}} if [ "$SVNREV" != "" ] @@ -96,16 +107,22 @@ old_precmd() SVNSTATUS=${SVNSTATUS:-$prompt_colors[up_to_date]} fi SVNREV=${SVNREV:+$C_$prompt_colors[doubledot]$_C:$C_$SVNSTATUS$_C"r"$SVNREV} + [ "$DEBUG" = "yes" ] && echo # get git status # + [ "$DEBUG" = "yes" ] && echo -n " GIT status..." GITBRANCH=$(get_git_branch) GITBRANCHSIZE=${#GITBRANCH} [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE)) + [ "$DEBUG" = "yes" ] && echo + [ "$DEBUG" = "yes" ] && echo -n " Path..." MY_PATH="%(!.%d.%~)" PATHSIZE=$(print -Pn $MY_PATH) PATHSIZE=${#PATHSIZE} + [ "$DEBUG" = "yes" ] && echo + [ "$DEBUG" = "yes" ] && echo -n " Resize path / gitbranch..." spaceleft=`print -Pn "%n@%m $ ls -laCdtrux $(expand_text "$DATE")"` spaceleft=$(($COLUMNS - ${#spaceleft})) #minimalpathsize=`print -Pn "../%1~"` @@ -137,6 +154,7 @@ old_precmd() [ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize GITBRANCH=${GITBRANCH:+$C_$prompt_colors[doubledot]$_C:$C_"$(get_git_status)"$_C$GITBRANCH} CURDIR="$C_$prompt_colors[path]$_C%`echo $spaceleft`<..<"$MY_PATH"%<<$C_$color[none]$_C" + [ "$DEBUG" = "yes" ] && echo ## Le prompt le plus magnifique du monde, et c'est le mien ! # Affiche l'user, l'host, le tty et le pwd. Rien que ça... -- cgit v1.2.3 From 57ac3b75d2e6eebd65745640ac0a6ebd0122d8d4 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 28 Feb 2008 18:14:27 +0100 Subject: Pas de gestion de l'option "multibyte" avec zsh@openwide --- 12_Prompts.zsh | 2 +- 20_Options.zsh | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to '12_Prompts.zsh') diff --git a/12_Prompts.zsh b/12_Prompts.zsh index c8c0eca..190b662 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -68,7 +68,7 @@ old_precmd() # Date [ "$DEBUG" = "yes" ] && echo -n " Date..." - DATE=$C_$prompt_colors[braces]$_C"[ "$C_$prompt_colors[date]$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$prompt_colors[braces]$_C" ]"$C_$prompt_colors[bar]$_C"-" + DATE=$C_$prompt_colors[braces]$_C"[ "$C_$prompt_colors[date]$_C"%D{%d-%m-%Y %H:%M:%S}"$C_$prompt_colors[braces]$_C" ]"$C_$prompt_colors[bar]$_C"-" DATEEXPAND=$(expand_text "$DATE") DATESIZE=${#DATEEXPAND} [ "$DEBUG" = "yes" ] && echo diff --git a/20_Options.zsh b/20_Options.zsh index f694bdf..ca0fb85 100644 --- a/20_Options.zsh +++ b/20_Options.zsh @@ -75,6 +75,3 @@ unsetopt Prompt_Cr setopt Auto_Pushd setopt Pushd_Ignore_Dups setopt Glob - -## Gestion de l'UTF-8 !! -setopt MultiByte -- cgit v1.2.3 From 217af2367f7a0cba677a0bbf2c130d45995b47be Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 6 Mar 2008 11:00:04 +0100 Subject: Affichage de l'@ IP au lieu du nom de la machine (vu qu'il veut rien dire) --- 10_Environment.zsh | 1 + 12_Prompts.zsh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to '12_Prompts.zsh') diff --git a/10_Environment.zsh b/10_Environment.zsh index 52d72f5..ed0312d 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -52,4 +52,5 @@ HISTFILE=$ZDOTDIR/.history.$USER.$HOSTNAME # Pour éviter les conflits de conf HISTSIZE=42000 SAVEHIST=42000 +LOCALIP=$(/sbin/ifconfig| grep adr: | awk '/192.168.3/ { print $2 } ' | cut -d: -f2) diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 190b662..971cfef 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -123,7 +123,7 @@ old_precmd() PATHSIZE=${#PATHSIZE} [ "$DEBUG" = "yes" ] && echo [ "$DEBUG" = "yes" ] && echo -n " Resize path / gitbranch..." - spaceleft=`print -Pn "%n@%m $ ls -laCdtrux $(expand_text "$DATE")"` + spaceleft=`print -Pn "%n@$LOCALIP $ ls -laCdtrux $(expand_text "$DATE")"` spaceleft=$(($COLUMNS - ${#spaceleft})) #minimalpathsize=`print -Pn "../%1~"` #minimalpathsize=${#minimalpathsize} @@ -161,7 +161,7 @@ old_precmd() # Note que pour le pwd, on n'affiche que les 4 derniers dossiers pour éviter # de pourrir le fenêtre de terminal avec un prompt à rallonge. PS1="$MAILSTAT""$ERROR"$C_$prompt_colors[bar]$_C"$HBAR""$DATE -"$C_$prompt_colors[user]$_C"%n"$C_$prompt_colors[arob]$_C"@"$C_$prompt_colors[host]$_C"%m $CURDIR$SVNREV$GITBRANCH "$C_$prompt_colors[dies]$_C"%#"$C_$prompt_colors[cmd]$_C" " +"$C_$prompt_colors[user]$_C"%n"$C_$prompt_colors[arob]$_C"@"$C_$prompt_colors[host]$_C"$LOCALIP $CURDIR$SVNREV$GITBRANCH "$C_$prompt_colors[dies]$_C"%#"$C_$prompt_colors[cmd]$_C" " } -- cgit v1.2.3 From a391c258df37309765cdaab674c8b62954647286 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 9 Apr 2008 15:40:15 +0200 Subject: Merge 'ow' dans 'master' / Reverts OpenWide-specifics config Revert "Pas de gestion de l'option 'multibyte' avec zsh@openwide" commit 57ac3b75d2e6eebd65745640ac0a6ebd0122d8d4. Revert "Affichage de l'@ IP au lieu du nom de la machine (vu qu'il veut rien dire)" commit 217af2367f7a0cba677a0bbf2c130d45995b47be. --- 10_Environment.zsh | 1 - 12_Prompts.zsh | 6 +++--- 20_Options.zsh | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to '12_Prompts.zsh') diff --git a/10_Environment.zsh b/10_Environment.zsh index ed0312d..52d72f5 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -52,5 +52,4 @@ HISTFILE=$ZDOTDIR/.history.$USER.$HOSTNAME # Pour éviter les conflits de conf HISTSIZE=42000 SAVEHIST=42000 -LOCALIP=$(/sbin/ifconfig| grep adr: | awk '/192.168.3/ { print $2 } ' | cut -d: -f2) diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 971cfef..c8c0eca 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -68,7 +68,7 @@ old_precmd() # Date [ "$DEBUG" = "yes" ] && echo -n " Date..." - DATE=$C_$prompt_colors[braces]$_C"[ "$C_$prompt_colors[date]$_C"%D{%d-%m-%Y %H:%M:%S}"$C_$prompt_colors[braces]$_C" ]"$C_$prompt_colors[bar]$_C"-" + DATE=$C_$prompt_colors[braces]$_C"[ "$C_$prompt_colors[date]$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$prompt_colors[braces]$_C" ]"$C_$prompt_colors[bar]$_C"-" DATEEXPAND=$(expand_text "$DATE") DATESIZE=${#DATEEXPAND} [ "$DEBUG" = "yes" ] && echo @@ -123,7 +123,7 @@ old_precmd() PATHSIZE=${#PATHSIZE} [ "$DEBUG" = "yes" ] && echo [ "$DEBUG" = "yes" ] && echo -n " Resize path / gitbranch..." - spaceleft=`print -Pn "%n@$LOCALIP $ ls -laCdtrux $(expand_text "$DATE")"` + spaceleft=`print -Pn "%n@%m $ ls -laCdtrux $(expand_text "$DATE")"` spaceleft=$(($COLUMNS - ${#spaceleft})) #minimalpathsize=`print -Pn "../%1~"` #minimalpathsize=${#minimalpathsize} @@ -161,7 +161,7 @@ old_precmd() # Note que pour le pwd, on n'affiche que les 4 derniers dossiers pour éviter # de pourrir le fenêtre de terminal avec un prompt à rallonge. PS1="$MAILSTAT""$ERROR"$C_$prompt_colors[bar]$_C"$HBAR""$DATE -"$C_$prompt_colors[user]$_C"%n"$C_$prompt_colors[arob]$_C"@"$C_$prompt_colors[host]$_C"$LOCALIP $CURDIR$SVNREV$GITBRANCH "$C_$prompt_colors[dies]$_C"%#"$C_$prompt_colors[cmd]$_C" " +"$C_$prompt_colors[user]$_C"%n"$C_$prompt_colors[arob]$_C"@"$C_$prompt_colors[host]$_C"%m $CURDIR$SVNREV$GITBRANCH "$C_$prompt_colors[dies]$_C"%#"$C_$prompt_colors[cmd]$_C" " } diff --git a/20_Options.zsh b/20_Options.zsh index ca0fb85..f694bdf 100644 --- a/20_Options.zsh +++ b/20_Options.zsh @@ -75,3 +75,6 @@ unsetopt Prompt_Cr setopt Auto_Pushd setopt Pushd_Ignore_Dups setopt Glob + +## Gestion de l'UTF-8 !! +setopt MultiByte -- cgit v1.2.3 From bb76357c72d67b5eab803fccce27617d178f7ed3 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 22 May 2008 17:06:44 +0200 Subject: Personnalized non-UTF8 title for PuTTY terms. Don't forget to set "TERM" to "putty" when needed... --- 01_Functions.zsh | 2 +- 12_Prompts.zsh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to '12_Prompts.zsh') diff --git a/01_Functions.zsh b/01_Functions.zsh index af6423c..d4c77bf 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -29,7 +29,7 @@ term_title() sun-cmd) print -Pn "\e]l%n@%m %~$1\e\\" # Never tested.. ;; - *term*|rxvt*) + *term*|rxvt*|putty) print -Pn "\e]0;%n@%m (%l) %~$1\a" # Sets term title ;; screen) diff --git a/12_Prompts.zsh b/12_Prompts.zsh index c8c0eca..b6cf511 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -24,7 +24,8 @@ set_prompt_colors $prompt_colors[generic] preexec () { - term_title " ··· $(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g')" + local my_sep=$([ "$TERM" = "putty" ] && echo "---" || echo "···") + term_title " $my_sep $(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g')" print -Pn "$C_$prompt_colors[exec]$_C" } -- cgit v1.2.3