From 5ecd382eb00360c3fec2f748496ef3e8f590b372 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 30 Jul 2009 15:43:43 +0200 Subject: Revert "[OW] Hash RTEL4I" This reverts commit f539990502e88571fb967f91da8a9cbdc80b91ec. --- net:opera.openwide.fr/host:groumpf/Hashes.zsh | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 net:opera.openwide.fr/host:groumpf/Hashes.zsh diff --git a/net:opera.openwide.fr/host:groumpf/Hashes.zsh b/net:opera.openwide.fr/host:groumpf/Hashes.zsh deleted file mode 100644 index 8264f4e..0000000 --- a/net:opera.openwide.fr/host:groumpf/Hashes.zsh +++ /dev/null @@ -1,3 +0,0 @@ - -hash -d RTEL4I=~/OpenWide/Projets/RTEL4I - -- cgit v1.2.3 From d92e40f3ae6db4694d3d78344c9530dc79b012cc Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 31 Jul 2009 09:51:43 +0200 Subject: [Funcs] removes the trailing '^0' for named-revs --- 01_Functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 5ec09fd..4c376c9 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -100,7 +100,7 @@ get_git_branch () # If not on a working GIT branch, get the named current commit-ish inside parenthesis [ "$my_git_branch" = "(no branch)" ] &&\ checkouted_branch="" && \ - my_git_branch="$(git-name-rev --name-only HEAD 2>&- | sed 's,^tags/,,;s,^remotes/,,')" + my_git_branch="$(git-name-rev --name-only HEAD 2>&- | sed 's,^tags/,,;s,^remotes/,,;s,\^0$,,')" # If neither on a named commit-ish, show commit-id if [ "$my_git_branch" = "undefined" ] -- cgit v1.2.3 From 018373e9222d939cad98a2264cf4d1eeeb0943dc Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 31 Jul 2009 09:52:18 +0200 Subject: [Env] Guess current display name --- 10_Environment.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/10_Environment.zsh b/10_Environment.zsh index 0009773..faef244 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -70,4 +70,16 @@ SAVEHIST=42000 export GPG_TTY=`tty` +# Display guess +CURRENT_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) +if [ "$DISPLAY" = "" -o "$CURRENT_DISPLAY" = "" ] +then + GUESS_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) + if [ "$GUESS_DISPLAY" != "" ] + then + export DISPLAY=$GUESS_DISPLAY + else + unset DISPLAY + fi +fi -- cgit v1.2.3 From eddf06b830b2ff5422515c9df76322e567f18f8e Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 31 Jul 2009 09:52:59 +0200 Subject: [Funcs] When only when .when exists. Yeah, really. --- 01_Functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 4c376c9..e1370e8 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -272,7 +272,7 @@ set_prompt_colors () chpwd() { - if cmd_exists when + if cmd_exists when && [ -e .when/birthdays ] then LATEST=`stat 2>&- --printf="%z\n" .when/.today | cut -d' ' -f1` TODAY=`date "+%Y-%m-%d"` -- cgit v1.2.3 From b7465ec2b06b53c942f56c6450422fcdd423fdd7 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 31 Jul 2009 09:57:05 +0200 Subject: [Prompts] groumpf@openwide displays a date/time instead of redisplaying prompt --- net:opera.openwide.fr/host:groumpf/Prompts.zsh | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 net:opera.openwide.fr/host:groumpf/Prompts.zsh diff --git a/net:opera.openwide.fr/host:groumpf/Prompts.zsh b/net:opera.openwide.fr/host:groumpf/Prompts.zsh new file mode 100644 index 0000000..09cd690 --- /dev/null +++ b/net:opera.openwide.fr/host:groumpf/Prompts.zsh @@ -0,0 +1,28 @@ +## +## Part of configuration files for Zsh 4 +## by Hugues Hiegel +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## + +preexec () +{ + term_title "$(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g;s/;$//')" + print -Pn "$C_$prompt_colors[exec]$_C" + + __START_CMD_DATE=$(date) + __START_CMD_ZSH_=$(date "+%s") +} + +precmd() +{ + __START_CMD_ZSH_=${__START_CMD_ZSH_:-$(date "+%s")} + [ "$[ `date "+%s"` - $__START_CMD_ZSH_ ]" -gt 1 ] && echo "$__START_CMD_DATE" + + update_prompt + redisplay_prompt +} + -- cgit v1.2.3 From e5f39ec71ed08d04ef3a38f3bc56ebfeaaf1e49b Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 10 Aug 2009 16:27:14 +0200 Subject: [Env] DISPLAY guessing better-ed --- 10_Environment.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_Environment.zsh b/10_Environment.zsh index faef244..0e0ef35 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -72,7 +72,7 @@ export GPG_TTY=`tty` # Display guess CURRENT_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) -if [ "$DISPLAY" = "" -o "$CURRENT_DISPLAY" = "" ] +if [ "$DISPLAY" = "" -a "$CURRENT_DISPLAY" = "" ] then GUESS_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) if [ "$GUESS_DISPLAY" != "" ] -- cgit v1.2.3 From 05c10fad1d46a3071f4e89a54be57bcb4b7c875d Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 1 Oct 2009 17:13:03 +0200 Subject: [Env] finger with stderr redirection --- 10_Environment.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/10_Environment.zsh b/10_Environment.zsh index 0e0ef35..e2d7a62 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -71,10 +71,10 @@ SAVEHIST=42000 export GPG_TTY=`tty` # Display guess -CURRENT_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) +CURRENT_DISPLAY=$(finger 2>&- | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) if [ "$DISPLAY" = "" -a "$CURRENT_DISPLAY" = "" ] then - GUESS_DISPLAY=$(finger | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) + GUESS_DISPLAY=$(finger 2>&- | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) if [ "$GUESS_DISPLAY" != "" ] then export DISPLAY=$GUESS_DISPLAY -- cgit v1.2.3 From 70db11de11eb4145844c45be94123f4ad7546318 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 1 Oct 2009 17:13:31 +0200 Subject: [Keys] adds verbosity to git-remote update shortkey. --- user:hugues/KeyBindings.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh index 6ac9ee9..1389e1d 100644 --- a/user:hugues/KeyBindings.zsh +++ b/user:hugues/KeyBindings.zsh @@ -215,7 +215,7 @@ do bindkey -M $keymap -s ' ' '\\ ' bindkey -M $keymap -s 'g' 'Q git-status\n' - bindkey -M $keymap -s 'G' 'Q git-remote update\n' + bindkey -M $keymap -s 'G' 'Q git-remote -v update\n' bindkey -M $keymap -s 'S' 'Q sudo !!' -- cgit v1.2.3 From dd33ef436cdd4aab59fb38239417a4f5ef804a17 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 1 Oct 2009 17:14:35 +0200 Subject: [Funcs] protects 'lastjob' var with double-quotes to avoid 'set' command call upon a fg. --- 01_Functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index e1370e8..983f5c0 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -30,7 +30,7 @@ term_title() if [ "$command[0]" = "fg" ] then lastjob=$(ps ft `tty` | grep "[0-9]\+[[:blank:]]\+`tty | sed 's/\/dev\///'`[[:blank:]]\+T.\? \+.:.. \\\_ " | tail -n1 | cut -c32-) - set $lastjob + set "$lastjob" fi if [ "$command[0]" = "screen" ] then -- cgit v1.2.3 From 71f1fe09120681fe8c33d866a0483ed13ea37cd1 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 1 Oct 2009 17:17:18 +0200 Subject: [Funcs] manages added files in an empty git repository --- 01_Functions.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 983f5c0..de4aa2d 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -187,7 +187,11 @@ get_git_status () elif [ "$not_up_to_date" != "" ] ; then my_git_status="$git_colors[not_up_to_date]" elif [ "$(git-cat-file -t HEAD 2>/dev/null)" != "commit" ] ; then - my_git_status="$git_colors[init_in_progress]" + if [ ! -z "$(git-ls-files)" ] ; then + my_git_status="$git_colors[cached]" + else + my_git_status="$git_colors[init_in_progress]" + fi else my_git_status="$git_colors[up_to_date]" fi -- cgit v1.2.3 From e47d74524a218159ea4d04aab36a61a9cc704694 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 1 Oct 2009 17:18:00 +0200 Subject: [Funcs] when rebasing, show full head name without 'refs/' and 'heads/' part --- 01_Functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index de4aa2d..9977147 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -141,7 +141,7 @@ get_git_branch () fi # Then the result - my_git_branch="[rebase $current/$last: "$(git-name-rev --name-only $(cat $REBASE_DIR/onto))".."$my_git_branch"] "$(basename $(cat $REBASE_DIR/head-name)) + my_git_branch="[rebase $current/$last: "$(git-name-rev --name-only $(cat $REBASE_DIR/onto))".."$my_git_branch"] "$(< $REBASE_DIR/head-name sed 's/^refs\///;s/^heads\///') else # No rebase in progress, put '(' ')' if needed [ ! "$checkouted_branch" ] && my_git_branch="($my_git_branch)" -- cgit v1.2.3