diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2008-03-27 08:37:28 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2008-03-27 08:37:28 +0100 |
commit | ce9c604ca0515d9dab62c2a59579e9651ad2773f (patch) | |
tree | 69aea38c2b6ff71b1fbcef2dc2267d37557d27a5 | |
parent | b9d078c02449ee54d684a93c367839fc6bf6cbaf (diff) | |
parent | a29f80d7684c725d81e8923d5d680384f7078db7 (diff) |
Merge branch 'master' of ssh://hiegel.fr/work/repos/zdotdir
-rw-r--r-- | .zlogin | 10 | ||||
-rw-r--r-- | 01_Functions.zsh | 8 | ||||
-rw-r--r-- | 11_Colors.zsh | 87 | ||||
-rw-r--r-- | 11_Prompts.zsh | 229 | ||||
-rw-r--r-- | 12_Prompts.zsh | 176 | ||||
-rw-r--r-- | user:hugues/KeyBindings.zsh | 368 |
6 files changed, 459 insertions, 419 deletions
@@ -2,10 +2,14 @@ #for _col in {1..$COLUMNS} ; do echo -n "_" ; done ;\ echo;\ preprint "événements" $color[bold] ; echo cmd_exists when && when w --calendar=~/.when/birthdays -cmd_exists calendar && calendar -A0 | sed "s/\(\*.*\)/[1m\1[0m/;s/\(\*.*\*\)/[33;1m\1[0m/" ;\ +#cmd_exists calendar && calendar -A0 | sed "s/\(\*.*\)/[1m\1[0m/;s/\(\*.*\*\)/[33;1m\1[0m/" ;\ -preprint "calendrier" $color[bold] ; echo -[ -x ~/sbin//calendrier ] && ~/sbin/calendrier +cmd_exists screen && [ "$(find /var/run/screen/S-$USER/ ! -type d | wc -l)" -gt 0 ] &&\ +preprint "screen" $color[bold] && echo &&\ +screen -list + +#preprint "calendrier" $color[bold] ; echo +#[ -x ~/sbin//calendrier ] && ~/sbin/calendrier #cmd_exists remind && remind -n # diff --git a/01_Functions.zsh b/01_Functions.zsh index 58a4ba5..3d1221d 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -87,13 +87,13 @@ get_git_status () if [ "$(git-rev-parse --git-dir)" == "." ] then - my_git_status="$COLOR_GIT_MANAGMENT" + my_git_status="$git_colors[managment_folder]" elif [ "$(git-diff --cached 2>&- | grep '^diff ')" != "" ] ; then - my_git_status="$COLOR_GIT_CACHED" + my_git_status="$git_colors[cached]" elif [ "$(git-ls-files -m 2>&-)" != "" ] ; then - my_git_status="$COLOR_GIT_NOT_UP_TO_DATE" + my_git_status="$git_colors[not_up_to_date]" else - my_git_status="$COLOR_GIT_UP_TO_DATE" + my_git_status="$git_colors[up_to_date]" fi echo $my_git_status diff --git a/11_Colors.zsh b/11_Colors.zsh new file mode 100644 index 0000000..ab455ca --- /dev/null +++ b/11_Colors.zsh @@ -0,0 +1,87 @@ +## +## Part of configuration files for Zsh 4 +## by Hugues Hiegel <hugues@hiegel.fr> +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## + +c_='['$color[none]";" +_c=m +C_="%{$c_" +_C="$_c%}" + +typeset -A prompt_colors git_colors mail_colors correct_colors + +# I hate kik00l0l colorized prompts, so I'm using a way to +# give a dominant color for each part of the prompt, each of +# these remain still configurable one by one. +# Take a look to set_prompt_colors for these colorizations. +# +# To set the dominant color I'm using this : +# +# - PS1_ROOT when we are root +# - PS1_USER for normal usage +# - PS1_USER_SSH when we are connected through SSH +# +# I'm storing the resulting dominant color in $prompt_colors[generic] + +PS1_ROOT=${PS1_ROOT:-$color[red]} +PS1_USER=${PS1_USER:-$color[blue]} +PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} +prompt_colors[generic]=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` + +normal_user && if ( [ "$SSH_TTY" != "" ] ) +then + # This allows us to easily distinguish shells + # which really are on the local machine or not. + # That's so good, use it ! :-) + prompt_colors[generic]=${PS1_USER_SSH:-$prompt_colors[generic]} +fi + +# +# This func is intended to give a quick way to set the colors for the +# prompt inside a running zsh-session +# +set_prompt_colors () +{ + local my_generic + my_generic=${1:-$prompt_colors[generic]} + + prompt_colors[path]="$my_generic;$color[bold]" # pwd + #prompt_colors[term]="$my_generic" # tty + prompt_colors[user]="$my_generic" # login + prompt_colors[host]="$my_generic" # hostname + #prompt_colors[hist]="$color[none]" # history number + prompt_colors[arob]="$color[bold];$my_generic" # <login>@<hostname> + prompt_colors[dies]="$my_generic" # the bottom-end of the prompt + prompt_colors[doubledot]="$color[none];" # separates pwd from git-branch + #prompt_colors[paren]="$color[cyan]" # parenthesis (around tty) + prompt_colors[bar]="$my_generic;$color[bold]" # horizontal bar + prompt_colors[braces]="$prompt_colors[bar]" # braces (around date) + prompt_colors[error]="$color[bold];$color[yellow]" # error code + prompt_colors[date]="$my_generic" # full date + + prompt_colors[cmd]="$color[none]" # command prompt + prompt_colors[exec]="$color[none]" # command output + + mail_colors[unread]="$color[yellow];$color[bold]" # mail received + mail_colors[listes]="$my_generic;$color[bold]" # less important mail received + + prompt_colors[up_to_date]="$my_generic" # up-to-date + prompt_colors[not_up_to_date]="$color[green];$color[bold]" # not up to date + prompt_colors[to_be_commited]="$color[yellow];$color[bold]" # changes in cache + + git_colors[managment_folder]="$color[red];$color[bold]" # .git/... folder browsing + git_colors[cached]="$prompt_colors[to_be_commited]" # git changes in cache + git_colors[not_up_to_date]="$prompt_colors[not_up_to_date]" # git changes in working tree + git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date +} + +set_prompt_colors + +correct_colors[error]="$color[red];$color[bold]" +correct_colors[suggest]="$color[blue];$color[bold]" + diff --git a/11_Prompts.zsh b/11_Prompts.zsh deleted file mode 100644 index 0baea0e..0000000 --- a/11_Prompts.zsh +++ /dev/null @@ -1,229 +0,0 @@ -## -## Part of configuration files for Zsh 4 -## by Hugues Hiegel <hugues@hiegel.fr> -## -## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS -## -## You are encouraged to use, modify, and redistribute -## these files with or without this notice. -## - -# I hate kik00l0l colorized prompts, so I'm using a way to -# give a dominant color for each part of the prompt, each of -# these remain still configurable one by one. -# Take a look to set_prompt_colors for these colorizations. -# -# To set the dominant color I'm using this : -# -# - PS1_ROOT when we are root -# - PS1_USER for normal usage -# - PS1_USER_SSH when we are connected through SSH -# -# I'm storing the resulting dominant color in $GENERIC - -PS1_ROOT=${PS1_ROOT:-$color[red]} -PS1_USER=${PS1_USER:-$color[blue]} -PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} -GENERIC=`print -Pn "%(! $PS1_ROOT $PS1_USER)"` - -normal_user && if ( [ "$SSH_TTY" != "" ] ) -then - # This allows us to easily distinguish shells - # which really are on the local machine or not. - # That's so good, use it ! :-) - GENERIC=${PS1_USER_SSH:-$GENERIC} -fi - -c_=[ -_c=m -C_="%{$c_" -_C="$_c%}" - -set_prompt_colors () -{ - local generic=${1:-$GENERIC} - - ## Les couleurs !! ## - COLOR_PATH="$color[reset];$generic;$color[bold]" # pwd - #COLOR_TERM="$color[reset];$generic" # tty - COLOR_USER="$color[reset];$generic" # login - COLOR_HOST="$color[reset];$generic" # hostname - #COLOR_HIST="$color[reset]" # history number - COLOR_AROB="$color[reset];1;%(! $color[bold]; )$generic" # <login>@<hostname> - COLOR_DIES="$color[reset];$generic" # the bottom-end of the prompt - COLOR_DOUBLEDOT="$color[reset];" # separates pwd from git-branch - #COLOR_PAREN="$color[reset];$color[cyan]" # parenthesis (around tty) - COLOR_MAIL="$color[reset];$color[yellow];$color[bold]" # mail received - COLOR_LISTES="$color[reset];$color[red];$color[bold]" # less important mail received - COLOR_BAR="$color[reset];$generic;$color[bold]" # horizontal bar - COLOR_BRACES=$COLOR_BAR # braces (around date) - COLOR_ERRR="$color[bold];$color[yellow]" # error code - COLOR_DATE="$color[reset];$generic" # full date - - COLOR_CMD="$color[reset]" # command prompt - COLOR_EXEC="$color[reset]" # command output - - COLOR_BRANCH_OR_REV="$color[reset];$generic" # up-to-date - COLOR_NOT_UP_TO_DATE="$color[reset];$color[green];$color[bold]" # not up to date - COLOR_TO_BE_COMMITED="$color[reset];$color[yellow];$color[bold]" # changes in cache - - COLOR_GIT_MANAGMENT="$color[reset];$color[red];$color[bold]" # .git/... folder browsing - COLOR_GIT_CACHED="$color[reset];$COLOR_TO_BE_COMMITED" # git changes in cache - COLOR_GIT_NOT_UP_TO_DATE="$color[reset];$COLOR_NOT_UP_TO_DATE" # git changes in working tree - COLOR_GIT_UP_TO_DATE="$color[reset];$generic" # git up-to-date -} - -set_prompt_colors $GENERIC - -## Prompts -# -# man zshmisc(1) -# - -## Automagic funcs -# -# chpwd : changement de répertoire -# preexec : avant d'exécuter une commande -# precmd : avant d'afficher le prompt -# - -preexec () -{ - term_title " ··· $(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g')" - print -Pn "$C_$COLOR_EXEC$_C" -} - -expand_text() -{ - # strips the %{...%} - print -Pn -- "$(echo $@ | sed 's/%{[^(%})]*%}//g')" -} - -new_precmd() -{ - # - # Arrays - # [0] prompt-style string - # [1] total size - # [2] color - # [3] pre-string - # [4] post-string - # - typeset -A ERROR DATE MAILS LOGIN HOST CWD GITINFO SVNINFO PRECMD - ERROR[color] = $COLOR_ERROR - ERROR[string] = "%(?;;%?)" - ERROR[pre] = "-" - ERROR[post] = - ERROR[size] = ${#$(print -Pn $ERROR["pre"]$ERROR["string"]$ERROR["post"])} -} - -old_precmd() -{ - # Error - error=$(print -Pn "%(?;;-%?)") - ERRORSIZE=${#error} - ERROR="%(?;;"$C_$COLOR_BAR$_C"-"$C_$COLOR_ERRR$_C"%?)" - - # Flush the term title - term_title - - # Date - DATE=$C_$COLOR_BRACES$_C"[ "$C_$COLOR_DATE$_C"%D{%a-%d-%b-%Y %H:%M:%S}"$C_$COLOR_BRACES$_C" ]"$C_$COLOR_BAR$_C"-" - DATEEXPAND=$(expand_text "$DATE") - DATESIZE=${#DATEEXPAND} - - # Mailcheck - 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_$COLOR_BAR$_C""-""$C_$COLOR_MAIL$_C""@" } else if (LISTES > 0) { print "$C_$COLOR_BAR$_C""-""$C_$COLOR_LISTES$_C""@" } }'`") - MAILSTATEXPAND=$(expand_text "$MAILSTAT") - MAILSTATSIZE=${#MAILSTATEXPAND} - - # First line of prompt, calculation of the remaining place - spaceleft=$((1 + $COLUMNS - $ERRORSIZE - $MAILSTATSIZE - $DATESIZE)) - - unset HBAR - for h in {1..$(($spaceleft - 1))} - do - HBAR=$HBAR- - done - - ## - ## Second line of prompt : don't let the path garbage the entire line - ## - - # get git status - # - GITBRANCH=$(get_git_branch) - GITBRANCHSIZE=${#GITBRANCH} - [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE)) - - MY_PATH="%(!.%d.%~)" - PATHSIZE=$(print -Pn $MY_PATH) - PATHSIZE=${#PATHSIZE} - spaceleft=`print -Pn "%n@%m $ ls -laCdtrux $(expand_text "$DATE")"` - spaceleft=$(($COLUMNS - ${#spaceleft})) - #minimalpathsize=`print -Pn "../%1~"` - #minimalpathsize=${#minimalpathsize} - minimalpathsize=10 - minimalgitsize=10 # git-abbrev-commit-ish... - if [ $GITBRANCHSIZE -gt 0 ] - then - if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ] - then - local unbreakablegittail - # reduce the git-branch until it is shrinked to $minimalgitsize characters max. - - if [ $GITBRANCH[-1] = ")" ] - then - unbreakablegittail=${${(M)GITBRANCH%\~*}} - [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=")" - fi - if [ $GITBRANCHSIZE -gt $minimalgitsize ] - then - GITBRANCHSIZE=$(( $spaceleft - $PATHSIZE )) - [ $GITBRANCHSIZE -lt $minimalgitsize ] && GITBRANCHSIZE=$minimalgitsize - fi - GITBRANCH=`print -Pn "%"$(($GITBRANCHSIZE - ${#unbreakablegittail}))">..>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}` - fi - fi - # then we reduce the path until it reaches the last path element, - spaceleft=$(($spaceleft - $GITBRANCHSIZE)) - [ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize - GITBRANCH=${GITBRANCH:+$C_$COLOR_DOUBLEDOT$_C:$C_"$(get_git_status)"$_C$GITBRANCH} - CURDIR="$C_$COLOR_PATH$_C%`echo $spaceleft`<..<"$MY_PATH"%<<$C_$color[reset]$_C" - -## 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... -# 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_$COLOR_BAR$_C"$HBAR""$DATE -"$C_$COLOR_USER$_C"%n"$C_$COLOR_AROB$_C"@"$C_$COLOR_HOST$_C"%m $CURDIR$GITBRANCH "$C_$COLOR_DIES$_C"%#"$C_$COLOR_CMD$_C" " - - -} - -precmd() -{ - old_precmd -} - -chpwd() -{ - which todo > /dev/null 2>&1 && todo -} - - -# Prompt level 2 -PS2="$C_$color[yellow];$color[bold]$_C%_$C_$color[reset];$color[cyan];$color[bold]$_C>$C_$color[reset]$_C " - -# Prompt level 3 -PS3="?# " - -# Prompt level 4 -PS4="+%N:%i> " - -# Prompt de droite, pour l'heure et le code d'erreur de la dernière commande -#RPS1="%(?;;"$C_$COLOR_ERRR$_C"%?"$C_$color[reset]$_C")" - -# Ultime : prompt de correction :-) -SPROMPT="zsh: $C_$color[blue]$_C%B'%R'%b$C_$color[reset]$_C ? Vous ne vouliez pas plutôt $C_$color[magenta]$_C%B'%r'%b$C_$color[reset]$_C ? [%BN%byae] " - diff --git a/12_Prompts.zsh b/12_Prompts.zsh new file mode 100644 index 0000000..a5b7348 --- /dev/null +++ b/12_Prompts.zsh @@ -0,0 +1,176 @@ +## +## Part of configuration files for Zsh 4 +## by Hugues Hiegel <hugues@hiegel.fr> +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## + +set_prompt_colors $prompt_colors[generic] + +## Prompts +# +# man zshmisc(1) +# + +## Automagic funcs +# +# chpwd : changement de répertoire +# preexec : avant d'exécuter une commande +# precmd : avant d'afficher le prompt +# + +preexec () +{ + term_title " ··· $(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g')" + print -Pn "$C_$prompt_colors[exec]$_C" +} + +expand_text() +{ + # strips the %{...%} + print -Pn -- "$(echo $@ | sed 's/%{[^(%})]*%}//g')" +} + +new_precmd() +{ + # + # Arrays + # [0] prompt-style string + # [1] total size + # [2] color + # [3] pre-string + # [4] post-string + # + typeset -A ERROR DATE MAILS LOGIN HOST CWD GITINFO SVNINFO PRECMD + ERROR[color] = $prompt_colors[error] + ERROR[string] = "%(?;;%?)" + ERROR[pre] = "-" + ERROR[post] = + ERROR[size] = ${#$(print -Pn $ERROR[pre]$ERROR[string]$ERROR[post])} +} + +old_precmd() +{ + # Error + error=$(print -Pn "%(?;;-%?)") + ERRORSIZE=${#error} + ERROR="%(?;;"$C_$prompt_colors[bar]$_C"-"$C_$prompt_colors[error]$_C"%?)" + + # Flush the term title + term_title + + # 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} + + # Mailcheck + 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} + + # First line of prompt, calculation of the remaining place + spaceleft=$((1 + $COLUMNS - $ERRORSIZE - $MAILSTATSIZE - $DATESIZE)) + + unset HBAR + for h in {1..$(($spaceleft - 1))} + do + HBAR=$HBAR- + done + + ## + ## Second line of prompt : don't let the path garbage the entire line + ## + + # get svn status + # + SVNREV=$(LC_ALL=C svn info 2>&- $PWD | awk '/^Revision: / {print $2}') + SVNREVSIZE=${#${SVNREV:+:r$SVNREV}} + if [ "$SVNREV" != "" ] + then + SVNSTATUS="$(svn status 2>&-)" + SVNSTATUS=${SVNSTATUS:+$prompt_colors[not_up_to_date]} + SVNSTATUS=${SVNSTATUS:-$prompt_colors[up_to_date]} + fi + SVNREV=${SVNREV:+$C_$prompt_colors[doubledot]$_C:$C_$SVNSTATUS$_C"r"$SVNREV} + + # get git status + # + GITBRANCH=$(get_git_branch) + GITBRANCHSIZE=${#GITBRANCH} + [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE)) + + MY_PATH="%(!.%d.%~)" + PATHSIZE=$(print -Pn $MY_PATH) + PATHSIZE=${#PATHSIZE} + spaceleft=`print -Pn "%n@%m $ ls -laCdtrux $(expand_text "$DATE")"` + spaceleft=$(($COLUMNS - ${#spaceleft})) + #minimalpathsize=`print -Pn "../%1~"` + #minimalpathsize=${#minimalpathsize} + minimalpathsize=10 + minimalgitsize=10 # git-abbrev-commit-ish... + if [ $GITBRANCHSIZE -gt 0 ] + then + if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ] + then + local unbreakablegittail + # reduce the git-branch until it is shrinked to $minimalgitsize characters max. + + if [ $GITBRANCH[-1] = ")" ] + then + unbreakablegittail=${${(M)GITBRANCH%\~*}} + [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=")" + fi + if [ $GITBRANCHSIZE -gt $minimalgitsize ] + then + GITBRANCHSIZE=$(( $spaceleft - $PATHSIZE )) + [ $GITBRANCHSIZE -lt $minimalgitsize ] && GITBRANCHSIZE=$minimalgitsize + fi + GITBRANCH=`print -Pn "%"$(($GITBRANCHSIZE - ${#unbreakablegittail}))">..>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}` + fi + fi + # then we reduce the path until it reaches the last path element, + spaceleft=$(($spaceleft - $GITBRANCHSIZE)) + [ $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" + +## 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... +# 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" " + + +} + +precmd() +{ + old_precmd +} + +chpwd() +{ + which todo > /dev/null 2>&1 && todo +} + + +# Prompt level 2 +PS2="$C_$color[yellow];$color[bold]$_C%_$C_$color[none];$color[cyan];$color[bold]$_C>$C_$color[none]$_C " + +# Prompt level 3 +PS3="?# " + +# Prompt level 4 +PS4="+%N:%i> " + +# Prompt de droite, pour l'heure et le code d'erreur de la dernière commande +#RPS1="%(?;;"$C_$prompt_colors[error]$_C"%?"$C_$color[none]$_C")" + +# Ultime : prompt de correction :-) +SPROMPT="zsh: $C_$correct_colors[error]$_C'%R'$C_$color[none]$_C ? Vous ne vouliez pas plutôt $C_$correct_colors[suggest]$_C'%r'$C_$color[none]$_C ? [%BN%byae] " + diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh index 2b1eb81..b9d43f5 100644 --- a/user:hugues/KeyBindings.zsh +++ b/user:hugues/KeyBindings.zsh @@ -14,41 +14,41 @@ # Lancez un chtit bindkey dans votre zsh pour voir... # -bindkey "[3~" delete-char # delete -bindkey "[2~" overwrite-mode # insert -bindkey "[A" up-line-or-history # up -bindkey "[B" down-line-or-history # down -bindkey "[A" history-search-backward # META-up -bindkey "[B" history-search-forward # META-down -bindkey "[C" forward-word # ESC right -bindkey "[D" backward-word # ESC left -bindkey "[3~" kill-region # ESC del +bindkey '[3~' delete-char # delete +bindkey '[2~' overwrite-mode # insert +bindkey '[A' up-line-or-history # up +bindkey '[B' down-line-or-history # down +bindkey '[A' history-search-backward # META-up +bindkey '[B' history-search-forward # META-down +bindkey '[C' forward-word # ESC right +bindkey '[D' backward-word # ESC left +bindkey '[3~' kill-region # ESC del # Pratique pour rehasher rapidement -bindkey -s "r" "Q rehash\n" +bindkey -s 'r' 'Q rehash\n' # Exécute la commande ``rt'' qui me permet de nettoyer toutes les saletés -bindkey -s "R" "Q rt\n" +bindkey -s 'R' 'Q rt\n' -test $TERM = "rxvt" -o $TERM = "xterm" -o $TERM = "aterm" && +test $TERM = 'rxvt' -o $TERM = 'xterm' -o $TERM = 'aterm' && { - bindkey "[1~" beginning-of-line # home - bindkey "[4~" end-of-line # end-of-line - bindkey "Oc" forward-word # CTRL right - bindkey "Od" backward-word # CTRL left - bindkey "[3$" vi-set-buffer # SHIFT del - bindkey "Oa" history-search-backward # CTRL UP - bindkey "Ob" history-search-forward # CTRL DOWN + bindkey '[1~' beginning-of-line # home + bindkey '[4~' end-of-line # end-of-line + bindkey 'Oc' forward-word # CTRL right + bindkey 'Od' backward-word # CTRL left + bindkey '[3$' vi-set-buffer # SHIFT del + bindkey 'Oa' history-search-backward # CTRL UP + bindkey 'Ob' history-search-forward # CTRL DOWN } # (gnome-terminal) -test $TERM = "xterm" && +test $TERM = 'xterm' && { - bindkey "OH" beginning-of-line # home - bindkey "OF" end-of-line # end-of-line + bindkey 'OH' beginning-of-line # home + bindkey 'OF' end-of-line # end-of-line } -#bindkey "\C-t" gosmacs-transpose-chars # J, ca c'est un truc pour toi +#bindkey '\C-t' gosmacs-transpose-chars # J, ca c'est un truc pour toi # ne pas oublier de s'en servir : # vi-match-bracket est sur ^X^B par defaut -# npo : quote-region est sur ESC-" par defaut +# npo : quote-region est sur ESC-' par defaut # npo : which-command est sur ESC-? par defaut # Lancez ``bindkey'' pour en savoir plus !! @@ -56,170 +56,172 @@ test $TERM = "xterm" && ## Résultat d'un ``bindkey'' -bindkey "#" set-mark-command -bindkey "^A" beginning-of-line -bindkey "^B" backward-char -bindkey "^D" delete-char-or-list -bindkey "^E" end-of-line -bindkey "^F" forward-char -bindkey "^G" send-break -bindkey "^H" backward-delete-char -bindkey "^I" expand-or-complete -bindkey "^J" accept-line -bindkey "^K" kill-line -bindkey "^L" clear-screen -bindkey "^M" accept-line -bindkey "^N" down-line-or-history -bindkey "^O" accept-line-and-down-history -bindkey "^P" up-line-or-history -bindkey "^Q" push-line -bindkey "^R" history-incremental-search-backward -bindkey "^S" history-incremental-search-forward -bindkey "^T" transpose-chars -bindkey "^U" kill-whole-line -bindkey "^V" quoted-insert -bindkey "^W" backward-kill-word -bindkey "^X^B" vi-match-bracket -bindkey "^X^F" vi-find-next-char -bindkey "^X^J" vi-join -bindkey "^X^K" kill-buffer -bindkey "^X^N" infer-next-history -bindkey "^X^O" overwrite-mode -bindkey "^X^R" _read_comp -bindkey "^X^U" undo -#bindkey "^X^V" vi-cmd-mode -bindkey "^X^X" exchange-point-and-mark -bindkey "^X*" expand-word -bindkey "^X=" what-cursor-position -bindkey "^X?" _complete_debug -bindkey "^XC" _correct_filename -bindkey "^XG" list-expand -bindkey "^Xa" _expand_alias -bindkey "^Xc" _correct_word -bindkey "^Xd" _list_expansions -bindkey "^Xe" _expand_word -bindkey "^Xg" list-expand -bindkey "^Xh" _complete_help -bindkey "^Xm" _most_recent_file -bindkey "^Xn" _next_tags -bindkey "^Xr" history-incremental-search-backward -bindkey "^Xs" history-incremental-search-forward -bindkey "^Xt" _complete_tag -bindkey "^Xu" undo -bindkey "^X~" _bash_list-choices -bindkey "^Y" yank -bindkey "^D" list-choices -bindkey "^G" send-break -bindkey "^H" backward-kill-word -bindkey "^I" self-insert-unmeta -bindkey "^J" self-insert-unmeta -bindkey "^L" clear-screen -bindkey "^M" self-insert-unmeta -bindkey "[3~" kill-region -bindkey "[A" history-search-backward -bindkey "[B" history-search-forward -bindkey "[C" forward-word -bindkey "[D" backward-word -bindkey "^_" copy-prev-word -bindkey " " magic-space -bindkey "!" expand-history -bindkey "\"" quote-region -bindkey "\$" spell-word -bindkey "'" quote-line #'" -bindkey "," _history-complete-newer -bindkey "-" neg-argument -bindkey "." insert-last-word -bindkey "/" _history-complete-older -bindkey "0" digit-argument -bindkey "1" digit-argument -bindkey "2" digit-argument -bindkey "3" digit-argument -bindkey "4" digit-argument -bindkey "5" digit-argument -bindkey "6" digit-argument -bindkey "7" digit-argument -bindkey "8" digit-argument -bindkey "9" digit-argument -bindkey "<" beginning-of-buffer-or-history -bindkey ">" end-of-buffer-or-history -bindkey "?" which-command -bindkey "A" accept-and-hold -bindkey "B" backward-word -bindkey "C" capitalize-word -bindkey "D" kill-word -bindkey "F" forward-word -bindkey "G" get-line -bindkey "H" run-help -bindkey "L" down-case-word -bindkey "N" history-search-forward -bindkey "OA" up-line-or-history -bindkey "OB" down-line-or-history -bindkey "OC" forward-char -bindkey "OD" backward-char -bindkey "P" history-search-backward -bindkey "Q" push-line -bindkey "S" spell-word -bindkey "T" transpose-words -bindkey "U" up-case-word -bindkey "W" copy-region-as-kill -bindkey "[1~" beginning-of-line -bindkey "[2~" overwrite-mode -bindkey "[3~" delete-char -bindkey "[4~" end-of-line -bindkey "[5~" history-beginning-search-backward-end -bindkey "[6~" history-beginning-search-forward-end -bindkey "[A" up-line-or-history -bindkey "[B" down-line-or-history -bindkey "[C" forward-char -bindkey "[D" backward-char -bindkey "_" insert-last-word -bindkey "a" accept-and-hold -bindkey "b" backward-word -bindkey "c" capitalize-word -bindkey "d" kill-word -bindkey "f" forward-word -bindkey "g" get-line -bindkey "h" run-help -bindkey "l" down-case-word -bindkey "n" history-search-forward -bindkey "p" history-search-backward -bindkey "q" push-line -bindkey "s" spell-word -bindkey "t" transpose-words -bindkey "u" up-case-word -bindkey "w" copy-region-as-kill -bindkey "x" execute-named-cmd -bindkey "y" yank-pop -bindkey "z" execute-last-named-cmd -bindkey "|" vi-goto-column -bindkey "~" _bash_complete-word -bindkey "^?" backward-kill-word -bindkey "^\[A" up-history -bindkey "^\[B" down-history -bindkey "^\[C" forward-char -bindkey "^\[D" backward-char -bindkey "^_" undo -bindkey " "-"~" self-insert -bindkey "" backward-delete-char -bindkey "\M-^@"-"\M-" self-insert +bindkey '#' set-mark-command +bindkey '^A' beginning-of-line +bindkey '^B' backward-char +bindkey '^D' delete-char-or-list +bindkey '^E' end-of-line +bindkey '^F' forward-char +bindkey '^G' send-break +bindkey '^H' backward-delete-char +bindkey '^I' expand-or-complete +bindkey '^J' accept-line +bindkey '^K' kill-line +bindkey '^L' clear-screen +bindkey '^M' accept-line +bindkey '^N' down-line-or-history +bindkey '^O' accept-line-and-down-history +bindkey '^P' up-line-or-history +bindkey '^Q' push-line +bindkey '^R' history-incremental-search-backward +bindkey '^S' history-incremental-search-forward +bindkey '^T' transpose-chars +bindkey '^U' kill-whole-line +bindkey '^V' quoted-insert +bindkey '^W' backward-kill-word +bindkey '^X^B' vi-match-bracket +bindkey '^X^F' vi-find-next-char +bindkey '^X^J' vi-join +bindkey '^X^K' kill-buffer +bindkey '^X^N' infer-next-history +bindkey '^X^O' overwrite-mode +bindkey '^X^R' _read_comp +bindkey '^X^U' undo +#bindkey '^X^V' vi-cmd-mode +bindkey '^X^X' exchange-point-and-mark +bindkey '^X*' expand-word +bindkey '^X=' what-cursor-position +bindkey '^X?' _complete_debug +bindkey '^XC' _correct_filename +bindkey '^XG' list-expand +bindkey '^Xa' _expand_alias +bindkey '^Xc' _correct_word +bindkey '^Xd' _list_expansions +bindkey '^Xe' _expand_word +bindkey '^Xg' list-expand +bindkey '^Xh' _complete_help +bindkey '^Xm' _most_recent_file +bindkey '^Xn' _next_tags +bindkey '^Xr' history-incremental-search-backward +bindkey '^Xs' history-incremental-search-forward +bindkey '^Xt' _complete_tag +bindkey '^Xu' undo +bindkey '^X~' _bash_list-choices +bindkey '^Y' yank +bindkey '^D' list-choices +bindkey '^G' send-break +bindkey '^H' backward-kill-word +bindkey '^I' self-insert-unmeta +bindkey '^J' self-insert-unmeta +bindkey '^L' clear-screen +bindkey '^M' self-insert-unmeta +bindkey '[3~' kill-region +bindkey '[A' history-search-backward +bindkey '[B' history-search-forward +bindkey '[C' forward-word +bindkey '[D' backward-word +bindkey '^_' copy-prev-word +bindkey ' ' magic-space +bindkey '!' expand-history +bindkey '\'' quote-region +bindkey '\$' spell-word +bindkey ''' quote-line #'' +bindkey ',' _history-complete-newer +bindkey '-' neg-argument +bindkey '.' insert-last-word +bindkey '/' _history-complete-older +bindkey '0' digit-argument +bindkey '1' digit-argument +bindkey '2' digit-argument +bindkey '3' digit-argument +bindkey '4' digit-argument +bindkey '5' digit-argument +bindkey '6' digit-argument +bindkey '7' digit-argument +bindkey '8' digit-argument +bindkey '9' digit-argument +bindkey '<' beginning-of-buffer-or-history +bindkey '>' end-of-buffer-or-history +bindkey '?' which-command +bindkey 'A' accept-and-hold +bindkey 'B' backward-word +bindkey 'C' capitalize-word +bindkey 'D' kill-word +bindkey 'F' forward-word +bindkey 'G' get-line +bindkey 'H' run-help +bindkey 'L' down-case-word +bindkey 'N' history-search-forward +bindkey 'OA' up-line-or-history +bindkey 'OB' down-line-or-history +bindkey 'OC' forward-char +bindkey 'OD' backward-char +bindkey 'P' history-search-backward +bindkey 'Q' push-line +bindkey 'S' spell-word +bindkey 'T' transpose-words +bindkey 'U' up-case-word +bindkey 'W' copy-region-as-kill +bindkey '[1~' beginning-of-line +bindkey '[2~' overwrite-mode +bindkey '[3~' delete-char +bindkey '[4~' end-of-line +bindkey '[5~' history-beginning-search-backward-end +bindkey '[6~' history-beginning-search-forward-end +bindkey '[A' up-line-or-history +bindkey '[B' down-line-or-history +bindkey '[C' forward-char +bindkey '[D' backward-char +bindkey '_' insert-last-word +bindkey 'a' accept-and-hold +bindkey 'b' backward-word +bindkey 'c' capitalize-word +bindkey 'd' kill-word +bindkey 'f' forward-word +bindkey 'g' get-line +bindkey 'h' run-help +bindkey 'l' down-case-word +bindkey 'n' history-search-forward +bindkey 'p' history-search-backward +bindkey 'q' push-line +bindkey 's' spell-word +bindkey 't' transpose-words +bindkey 'u' up-case-word +bindkey 'w' copy-region-as-kill +bindkey 'x' execute-named-cmd +bindkey 'y' yank-pop +bindkey 'z' execute-last-named-cmd +bindkey '|' vi-goto-column +bindkey '~' _bash_complete-word +bindkey '^?' backward-kill-word +bindkey '^\[A' up-history +bindkey '^\[B' down-history +bindkey '^\[C' forward-char +bindkey '^\[D' backward-char +bindkey '^_' undo +bindkey ' '-'~' self-insert +bindkey '' backward-delete-char +bindkey '\M-^@'-'\M-' self-insert # Raccourcis pour les todo : funny :) -# "q" stands for "push-line" -bindkey -s "t" "Q todo\n" -#bindkey -s "T" "Q todo all -c\n" +# 'q' stands for 'push-line' +bindkey -s 't' 'Q todo\n' +#bindkey -s 'T' 'Q todo all -c\n' -bindkey -s "é" " 2>/dev/null " -bindkey -s "2" " 2>&1 " +bindkey -s 'é' ' 2>/dev/null ' +bindkey -s '2' ' 2>&1 ' -bindkey -s "m" "Q mails\n" -bindkey -s "M" "make " +bindkey -s 'm' 'Q mails\n' +bindkey -s 'M' 'make ' -bindkey -s "l" "Q l\n" -#bindkey -s "L" "Q la\n" +bindkey -s 'l' 'Q l\n' +#bindkey -s 'L' 'Q la\n' -bindkey -s " " "\\\\ " +bindkey -s ' ' '\\ ' -bindkey -s "g" "Q git-status\n" -bindkey -s "G" "Q git-repack\n" +bindkey -s 'g' 'Q git-status\n' +bindkey -s 'G' 'Q git-repack\n' -bindkey -s "X" "Q exec zsh\n" +bindkey -s 'S' 'Q svn status\n' + +bindkey -s 'X' 'Q exec zsh\n' |