X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=.bashrc;h=c458a2f6f58b5a290e1eb8f0225dd2c54b6ef368;hb=3a3a3a4e3009bfbe6268dc61ac99a4d0837d0db9;hp=18f1e67239a2734f717ac967a9d2faa54e890411;hpb=8f680b855e917548cf52e577cbf543c7100c4afd;p=config-20-100.git diff --git a/.bashrc b/.bashrc index 18f1e67..c458a2f 100644 --- a/.bashrc +++ b/.bashrc @@ -100,7 +100,7 @@ function cd { builtin cd "$@" ret=$? if [ -f ~/.umaskrc ]; then - umask $(/usr/bin/awk 'BEGIN {pwd=ENVIRON["PWD"]; a=length(pwd); cmax=0} {if($1==pwd) {MASK=$2;exit}; c=length($1); if(c>a) {next}; if(substr(pwd,0,c)==$1 && c > cmax) {cmax=c; MASK=$2}} END {print MASK}' ~/.umaskrc) >/dev/null + umask $(/usr/bin/awk 'BEGIN {pwd=ENVIRON["PWD"]"/"; a=length(pwd); cmax=0} {if($1==pwd) {MASK=$2;exit}; c=length($1); if(c>a) {next}; if(substr(pwd,0,c+1)==$1 && c > cmax) {cmax=c; MASK=$2}} END {print MASK}' ~/.umaskrc) >/dev/null fi return $ret } @@ -116,25 +116,34 @@ function cd { # les couleurs doivent être entourés de \[ et \] pour délimiter les caractères # invisibles cyan='\e[1;36m' +cyan_thin='\e[0;36m' violet='\e[1;35m' violet_thin='\e[0;35m' jaune='\e[1;33m' jaune_thin='\e[0;33m' rouge='\e[1;31m' +rouge_thin='\e[0;31m' vert='\e[1;32m' vert_thin='\e[0;32m' bleu='\e[1;34m' +bleu_thin='\e[0;34m' blanc='\e[1;37m' +blanc_thin='\e[0;37m' nocolor='\e[0m' cyan_prompt="\[${cyan}\]" +cyan_thin_prompt="\[${cyan_thin}\]" violet_prompt="\[${violet}\]" violet_thin_prompt="\[${violet_thin}\]" jaune_prompt="\[${jaune}\]" jaune_thin_prompt="\[${jaune_thin}\]" rouge_prompt="\[${rouge}\]" +rouge_thin_prompt="\[${rouge_thin}\]" vert_prompt="\[${vert}\]" vert_thin_prompt="\[${vert_thin}\]" bleu_prompt="\[${bleu}\]" +bleu_thin_prompt="\[${bleu_thin}\]" +blanc_prompt="\[${blanc}\]" +blanc_thin_prompt="\[${blanc_thin}\]" nocolor_prompt="\[${nocolor}\]" if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then @@ -162,6 +171,11 @@ else color_prompt=no fi +# Est-ce qu'on veut que le prompt affiche les information sur l'éventuel dépôt +# versionné dans lequel on se trouve +#~# # Changez cette variable en "yes" pour l'afficher +display_vcs_info=no + # Génération de la ligne de "-" function gen_minus_line @@ -184,9 +198,11 @@ function prompt_command local pwd ERR DATE PROMPT DIR POST_DIR (( SAVE_COLUMNS == COLUMNS )) || gen_minus_line - #~# # À décommenter si on veut des infos - #~# # quand on se trouve dans un dépôt versionné - #~# get_vcs_info + # À décommenter si on veut des infos + # quand on se trouve dans un dépôt versionné + if [ "$display_vcs_info" = yes ]; then + get_vcs_info + fi pwd=${PWD/#$HOME/'~'} if (( ${#pwd} + ${VCS_size} + 27 > COLUMNS )); then @@ -208,7 +224,7 @@ function prompt_command # il faut changer $((31+($?==0)*6)) si vous y tenez vraiment et que vous comprenez ce que vous faites ERR='[ \[\e[1;$((31+($?==0)*6))m\]$?'${line_color_prompt}' ]'$MINUS_CHAR DATE="( ${date_color}\D{%H:%M:%S}${line_color_prompt} )" - PROMPT="${username_color}\u${symbols_color}@${host_color}\h ${symbols_color}\$ ${nocolor_prompt}" + PROMPT="${username_color}\u${symbols_color}@${host_color}\h ${symbols_color}\\\$ ${nocolor_prompt}" PS1=$TITLE${line_color_prompt}$MINUS_CHAR$DATE$MINUS_CHAR$DIR$MINUS_CHAR$VCS_info${line_color_prompt}$POST_DIR$ERR'\n'$PROMPT else DIR="< "$DIR" >"