diff options
-rw-r--r-- | 01_Functions.zsh | 12 | ||||
-rw-r--r-- | 10_Environment.zsh | 12 | ||||
-rw-r--r-- | net:opera.openwide.fr/host:groumpf/Hashes.zsh | 3 | ||||
-rw-r--r-- | net:opera.openwide.fr/host:groumpf/Prompts.zsh | 28 | ||||
-rw-r--r-- | user:hugues/KeyBindings.zsh | 2 |
5 files changed, 49 insertions, 8 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh index f073945..cc37ba8 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 @@ -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" ] @@ -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)" @@ -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 diff --git a/10_Environment.zsh b/10_Environment.zsh index 0009773..e2d7a62 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -70,4 +70,16 @@ SAVEHIST=42000 export GPG_TTY=`tty` +# Display guess +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 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 + else + unset DISPLAY + fi +fi 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 - 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 <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. +## + +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 "[1;30m$__START_CMD_DATE[0m" + + update_prompt + redisplay_prompt +} + 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 !!' |