From 677e279659989347460af25ff52c7b3554efb843 Mon Sep 17 00:00:00 2001 From: hugues Date: Sat, 23 Sep 2006 11:49:54 +0000 Subject: =?utf-8?q?Nombreuses=20mises=20=C3=A0=20jour, =20en=20particulier=20les=20couleurs=20du=20prompt=20yAy?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.5.4.1" This is a multi-part message in MIME format. --------------1.5.4.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://hugues@maison/opt/svn/private/hugues@273 a0e5b806-a6f9-0310-978d-cbce73f8a913 --- 25_Prompts.zsh | 64 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) (limited to '25_Prompts.zsh') diff --git a/25_Prompts.zsh b/25_Prompts.zsh index 7309d7f..0bcf67a 100644 --- a/25_Prompts.zsh +++ b/25_Prompts.zsh @@ -1,4 +1,3 @@ -#!/bin/zsh ## ## Part of configuration files for Zsh 4 ## by Hugues Hiegel @@ -9,30 +8,25 @@ ## these files with or without this notice. ## +VOID=0 +BOLD=1 +UNDERLINE=4 +RED=31 +GREEN=32 +YELLOW=33 +BLUE=34 +MAGENTA=35 +CYAN=36 +WHITE=37 + # Pour personnaliser les couleurs du prompt, configurez ces variables : # - PS1_ROOT pour la couleur du prompt ROOT # - PS1_USER pour la couleur du prompt USER local # - PS1_USER_SSH pour la couleur du prompt USER distant -C_="%{[" -_C="m%}" - -COLOR_RSET=0 -COLOR_BOLD=1 -COLOR_LINE=4 -COLOR_RED=31 -COLOR_GREEN=32 -COLOR_YELLOW=33 -COLOR_BLUE=34 -COLOR_MAGENTA=35 -COLOR_CYAN=36 - -## Couleur par défaut pour le prompt ROOT (c'est super pour sudo, ça...) -PS1_ROOT=${PS1_ROOT:-$COLOR_RED} - -# Couleur par défaut pour les utilisateurs normaux (moi, quoi) -PS1_USER=${PS1_USER:-$COLOR_BLUE} -PS1_USER_SSH=${PS1_USER_SSH:-$COLOR_MAGENTA} +PS1_ROOT=$RED +PS1_USER=$BLUE +PS1_USER_SSH=$MAGENTA if ( [ "$SSH_TTY" != "" ] ) then @@ -42,19 +36,19 @@ then PS1_USER=${PS1_USER_SSH:-$PS1_USER} fi -PS1_COLOR="%(!.$PS1_ROOT.$PS1_USER)" - -# COULEURS DU PROMPT -# La classe. - -PATHCOLOR="$C_$COLOR_RSET;$PS1_COLOR$_C" -USERCOLOR="$C_$COLOR_RSET;$PS1_COLOR$_C" -HOSTCOLOR="$C_$COLOR_RSET;$PS1_COLOR$_C" -TERMCOLOR="$C_$COLOR_RSET;$COLOR_CYAN$_C" -ERRRCOLOR="$C_$COLOR_RED$_C" -RESET="$C_$COLOR_RSET$_C" -MISC="$C_$COLOR_RSET;$COLOR_BOLD;$PS1_COLOR$_C" +## Les couleurs !! ## +C_="%{[" +_C="m%}" +COLOR_PATH="0;%(!.$PS1_ROOT.$BOLD;$PS1_USER)" +COLOR_TERM="0;%(!.$PS1_ROOT.$PS1_USER)" +COLOR_USER="0;%(!.$PS1_ROOT.$PS1_USER)" +COLOR_HOST="0;%(!.$PS1_ROOT.$PS1_USER)" +COLOR_HIST=$VOID +COLOR_AROB="0;1;%(!.$BOLD;$PS1_ROOT.$PS1_USER)" +COLOR_DIES="0;%(!.$BOLD;$PS1_ROOT.$PS1_USER)" +COLOR_ERRR="$BOLD;$RED" +COLOR_DATE="0;%(!.$PS1_ROOT.$PS1_USER)" ## Prompts # @@ -69,7 +63,7 @@ MISC="$C_$COLOR_RSET;$COLOR_BOLD;$PS1_COLOR$_C" # Affiche l'user, l'host, le tty et le pwd. Rien que ça... # 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=$USERCOLOR"%n"$MISC"@"$HOSTCOLOR"%m"$RESET" ("$TERMCOLOR"%y"$RESET") ["$PATHCOLOR"%(!.%d.%(5~:.../%4~:%~))"$RESET"]"${LD_PRELOAD:t:s/lib//:r}" %h"$MISC"#"$RESET" " +PS1=""$C_$COLOR_USER$_C"%n"$C_$COLOR_AROB$_C"@"$C_$COLOR_HOST$_C"%m"$C_$VOID$_C" ("$C_$COLOR_TERM$_C"%y"$C_$VOID$_C") ["$C_$COLOR_PATH$_C"%(!.%d.%(5~:.../:)%4~)"$C_$VOID$_C"]"${LD_PRELOAD:t:s/lib//:r}" "$C_$COLOR_HIST$_C"%h"$C_$COLOR_DIES$_C"#"$C_$VOID$_C" " # Prompt level 2 PS2="%{%}%B%_%b%{%}%B>%b%{%} " @@ -81,8 +75,8 @@ PS3="?# " PS4="+%N:%i> " # Prompt de droite, pour l'heure et le code d'erreur de la dernière commande -RPS1="%(?..$ERRRCOLOR%?$COLOR_RSET) %{[0;%(!."$PS1_ROOT"."$PS1_USER")m%}%D{%a%d%b|%H:%M\'%S}%{%}" +RPS1="%(?;;"$C_$COLOR_ERRR$_C"%?"$C_$VOID$_C") "$C_$COLOR_DATE$_C"%D{%H:%M:%S %d/%m/%Y}"$C_$VOID$_C"" # Ultime : prompt de correction :-) -SPROMPT="zsh: %{%}%B«%R»%b%{%} ? Vous ne vouliez pas plutôt %{%}%B«%r»%b%{%} ? [%BN%byae] " +SPROMPT="zsh: $_C_$BLUE$_C%B'%R'%b%C_$VOID$_C ? Vous ne vouliez pas plutôt $C_$MAGENTA$_C%B'%r'%b$C_$VOID$_C ? [%BN%byae] " -- cgit v1.2.3