summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zlogin36
-rw-r--r--01_Internal.zsh13
-rw-r--r--10_Environment.zsh33
-rw-r--r--12_Prompts.zsh107
-rw-r--r--99_Exec.zsh11
-rw-r--r--user:hugues/Aliases.zsh15
-rw-r--r--user:hugues/Environment.zsh4
-rw-r--r--user:hugues/GusBindings.zsh2
-rw-r--r--zshrc1
9 files changed, 113 insertions, 109 deletions
diff --git a/.zlogin b/.zlogin
index 280fe3b..b59bef9 100644
--- a/.zlogin
+++ b/.zlogin
@@ -1,6 +1,40 @@
+if ( ! __zsh_status )
+then
+ echo
+ echo -n $c_$_prompt_colors[warning]$_c
+ #toilet -f bigmono9 "D1rTY Zsh.."
-__cmd_exists keychain && eval $(keychain)
+ HBAR=${${(l:13::q:)}//q/$_tq_}
+ VBAR=$T_$_tx_$_T
+
+ echo
+ echo -n " "
+ echo -n $T_$_tl_
+ echo -n $HBAR
+ echo -n $_tk_$_T
+ echo
+ echo " $VBAR WARNING !! $VBAR"
+ echo " $VBAR D1rTY Zsh.. $VBAR"
+
+ echo -n " "
+ echo -n $T_$_tm_
+ echo -n $HBAR
+ echo -n $_tj_$_T
+ echo
+ echo $c_$_prompt_colors[none]$_c
+fi
+
+__cmd_exists keychain && eval $(keychain --inherit any --eval)
__cmd_exists when && when
+if __cmd_exists fortune
+then
+ __preprint "Pensée du jour"
+ fortune | fmt -s -w 74
+ __preprint
+ echo
+fi | sed 's/^/ /'
+
+
true
diff --git a/01_Internal.zsh b/01_Internal.zsh
index a73772c..42d4af4 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -26,6 +26,8 @@ __cmd_exists ()
which -p $1 >/dev/null 2>&1
}
+__cmd_exists keychain && eval $(keychain --inherit any --eval --quiet)
+
__term_title()
{
__debug -n " Term title..."
@@ -49,12 +51,15 @@ __term_title()
then
case $TERM in
sun-cmd)
+ __debug -n "\n - sun"
print -Pn "\e]l%n@%m %~$@\e\\" # Never tested..
;;
*term*|rxvt*|putty)
+ __debug -n "\n - term/rxvt/putty"
print -Pn "\e]0;%n@%m (%l) %~${@//\%/%%}\a" # Sets term title
;;
screen*)
+ __debug -n "\n - screen"
local _sep=""
[ $# -gt 0 ] && _sep=$1 && shift # gets and discards the separator, if any.
# Tmux
@@ -303,15 +308,15 @@ __get_git_branch ()
onto=$(git name-rev --name-only --always --no-undefined $(cat $REBASE_DIR/onto) 2>&- | __cleanup_git_branch_name)
# amended commit
- if [ -e $REBASE_DIR/amend ]
+ if [ -e $REBASE_DIR/stopped-sha ]
+ then
+ amend=$(cat $REBASE_DIR/stopped-sha)
+ elif [ -e $REBASE_DIR/amend ]
then
amend=$(cat $REBASE_DIR/amend)
elif [ -e $REBASE_DIR/original-commit ]
then
amend=$(cat $REBASE_DIR/original-commit)
- elif [ -e $REBASE_DIR/stopped-sha ]
- then
- amend=$(cat $REBASE_DIR/stopped-sha)
fi
#
if [ "$amend" != "$commit_ish" ]
diff --git a/10_Environment.zsh b/10_Environment.zsh
index ce82154..714172f 100644
--- a/10_Environment.zsh
+++ b/10_Environment.zsh
@@ -26,28 +26,33 @@ _c=m
C_="%{$c_"
_C="$_c%}"
-unset has_termcaps
+unset _has_tcaps
case "$( _process_tree )" in
*":: SCREEN ::"*)
# Discards termcaps even if screen is launched from an urxvt..
;;
*":: "*"urxvt ::"*|\
*":: tmux ::"*)
- has_termcaps="true"
+ has_termcaps=${has_termcaps:-true}
;;
*)
;;
esac
-T_=${has_termcaps:+$termcap[as]}
-_T=${has_termcaps:+$termcap[ae]}
-_tq_=${${has_termcaps:+"q"}:-"-"}
-_tj_=${${has_termcaps:+"j"}:-"'"}
-_tk_=${${has_termcaps:+"k"}:-"."}
-_tl_=${${has_termcaps:+"l"}:-","}
-_tm_=${${has_termcaps:+"m"}:-"\`"}
-_tt_=${${has_termcaps:+"t"}:-"]"}
-_tu_=${${has_termcaps:+"u"}:-"["}
-_tx_=${${has_termcaps:+"x"}:-"|"}
+_has_tcaps="${has_termcaps}"
+[ "${_has_tcaps}" != "true" ] && unset _has_tcaps
+
+T_=${_has_tcaps:+$termcap[as]}
+_T=${_has_tcaps:+$termcap[ae]}
+_tq_=${${_has_tcaps:+"q"}:-"-"}
+_tj_=${${_has_tcaps:+"j"}:-"'"}
+_tk_=${${_has_tcaps:+"k"}:-"."}
+_tl_=${${_has_tcaps:+"l"}:-","}
+_tm_=${${_has_tcaps:+"m"}:-"\`"}
+_tt_=${${_has_tcaps:+"t"}:-"]"}
+_tu_=${${_has_tcaps:+"u"}:-"["}
+_tx_=${${_has_tcaps:+"x"}:-"|"}
+# Not needed anymore
+unset _has_tcaps
# I hate kik00l0l colorized prompts, so I'm using a way to
# give a dominant color for each part of the prompt, each of
@@ -94,9 +99,11 @@ HISTSIZE=$(( $SAVEHIST * 1.10 ))
export GPG_TTY=`tty`
# YeahConsole..
-if ( ps x 2>&- | grep $$ -B1 | grep -q yeahconsole )
+if ( ps 2>&- | grep $$ -B1 | grep -q yeahconsole )
then
_yeahconsole=true
+else
+ _yeahconsole=false
fi
# Display guess
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 18508a4..6537b07 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -176,52 +176,45 @@ __ssh_gpg_agents ()
}
PS1_TASKBAR+=(__ssh_gpg_agents)
+__display ()
+{
+ __debug -n " Display..."
+ echo ${DISPLAY:+$C_$_prompt_colors[display]$_C"("$DISPLAY")"}
+ __debug
+}
+PS1_TASKBAR+=(__display)
+
__battery() {
__debug -n " Battery..."
- # POWERADAPTER=$(grep "^AC Power" /proc/pmu/info | cut -c26)
-
- # typeset -A battery
- # battery[remaining]=$(grep "^time rem" /proc/pmu/battery_0 | cut -c14- )
- # battery[remain_hrs]=$(( $battery[remaining] / 3600 ))
- # battery[remain_min]=$(( ($battery[remaining] - ( $battery[remain_hrs] * 3600 )) / 60 ))
- # [ "$battery[remain_min]" -lt 10 ] && battery[remain_min]="0"$battery[remain_min]
- # battery[remains]=$battery[remain_hrs]"h"$battery[remain_min]
-
- # BATTERYSIZE=$(( ${#battery[remains]} + 1 ))
-
- # battery[load]=$(grep "^current" /proc/pmu/battery_0 | cut -c14- )
-
- # if [ $POWERADAPTER -ne 0 ]
- # then
- # battery[color]="charging"
- # if [ $battery[load] -eq 0 ]
- # then
- # ## Battery full
- # BATTERYSIZE=2
- # battery[remains]="⚡"
- # fi
- # else
- # if [ $battery[remaining] -lt 659 ]
- # then
- # battery[color]="critical"
- # else
- # battery[color]="uncharging"
- # fi
- # fi
-
BATTPERCENT=$(acpi -b | cut -d, -f2 | tr -d ' %')
- echo -n $termcap[as]"u"
+ POWER=$(acpi -a | grep -q 'on-line' ; echo $?)
+ BATTCHARGING=$(acpi -b | grep -q 'Charging' ; echo $?)
+
+ if [ "$POWER" -eq 0 -a ! "$BATTCHARGING" -eq 0 ]
+ then
+ return
+ fi
+
+ echo -n $termcap[as]
+ echo -n "u"
if [ $BATTPERCENT -le 10 ]
then
echo -n $C_"31"$_C
elif [ $BATTPERCENT -le 25 ]
then
- echo -n $C_"33"$_C
+ echo -n $C_"33;1"$_C
+ else
+ if [ $POWER -eq 0 ]
+ then
+ echo -n $C_"44;34;1"$_C
+ else
+ echo -n $C_"34;1"$_C
+ fi
fi
- for i in {0..9}
+ for i in {0..4}
do
- if [ $i -le $(($BATTPERCENT / 10)) ]
+ if [ $i -le $(($BATTPERCENT / 20)) ]
then
echo -n "a"
else
@@ -229,18 +222,11 @@ __battery() {
fi
done
echo -n $C_$_prompt_colors[generic]$_C
- echo -n "t"$termcap[ae]
+ echo -n "t"
+ echo -n $termcap[ae]
__debug
}
-which acpi && PS1_TASKBAR+=(__battery)
-
-__display ()
-{
- __debug -n " Display..."
- echo ${DISPLAY:+$C_$_prompt_colors[display]$_C"("$DISPLAY")"}
- __debug
-}
-PS1_TASKBAR+=(__display)
+__cmd_exists acpi && PS1_TASKBAR+=(__battery)
__vcsbranch ()
{
@@ -320,7 +306,7 @@ __subvcsbranches () {
echo $GITBRANCH
}
-PS1_TASKBAR+=(__subvcsbranches)
+#PS1_TASKBAR+=(__subvcsbranches)
__redefine_prompt ()
{
@@ -332,6 +318,7 @@ __redefine_prompt ()
__two_lines_prompt
;;
esac
+ setterm -cursor on
}
zle -N __redefine_prompt
@@ -402,32 +389,6 @@ __two_lines_prompt ()
}
-if ( ! __zsh_status )
-then
- echo
- echo -n $c_$_prompt_colors[warning]$_c
- #toilet -f bigmono9 "D1rTY Zsh.."
-
- HBAR=${${(l:13::q:)}//q/$_tq_}
- VBAR=$T_$_tx_$_T
-
- echo
- echo -n " "
- echo -n $T_$_tl_
- echo -n $HBAR
- echo -n $_tk_$_T
- echo
- echo " $VBAR WARNING !! $VBAR"
- echo " $VBAR D1rTY Zsh.. $VBAR"
-
- echo -n " "
- echo -n $T_$_tm_
- echo -n $HBAR
- echo -n $_tj_$_T
- echo
- echo $c_$_prompt_colors[none]$_c
-fi
-
precmd()
{
# Catchs ERROR code
@@ -437,8 +398,6 @@ precmd()
__redefine_prompt
}
-
-
# Prompt level 3
PS3="?# "
diff --git a/99_Exec.zsh b/99_Exec.zsh
index e8f8a1a..612b487 100644
--- a/99_Exec.zsh
+++ b/99_Exec.zsh
@@ -8,13 +8,4 @@
## these files with or without this notice.
##
-if __cmd_exists fortune
-then
- __preprint "Pensée du jour"
- fortune | fmt -s -w 74
- __preprint
- echo
-fi | sed 's/^/ /'
-
-chpwd
-
+cd .
diff --git a/user:hugues/Aliases.zsh b/user:hugues/Aliases.zsh
index aefe795..99304f8 100644
--- a/user:hugues/Aliases.zsh
+++ b/user:hugues/Aliases.zsh
@@ -7,8 +7,8 @@
## You are encouraged to use, modify, and redistribute
## these files with or without this notice.
##
-a -g ¬ISO='LC_ALL=fr_FR'
-a -g ¬UTF='LC_ALL=fr_FR.UTF-8'
+a -g ¬ISO='LC_ALL=br_FR'
+a -g ¬UTF='LC_ALL=br_FR.UTF-8'
a -g ...=../..
a -g ....=../../..
@@ -17,9 +17,16 @@ a -g ......=../../../../..
a -g .......=../../../../../..
a -g ........=../../../../../../..
a -g .........=../../../../../../../..
-
+a -g ..........=../../../../../../../../..
+a -g ...........=../../../../../../../../../..
+a -g ............=../../../../../../../../../../..
+a -g .............=../../../../../../../../../../../..
+a -g ..............=../../../../../../../../../../../../..
+a -g ...............=../../../../../../../../../../../../../..
+a -g ................=../../../../../../../../../../../../../../..
+
if ( __cmd_exists emacs )
-then
+then
a e='emacs'
a ne='e -nw'
a gnus='e -f gnus'
diff --git a/user:hugues/Environment.zsh b/user:hugues/Environment.zsh
index 112110e..492fdc9 100644
--- a/user:hugues/Environment.zsh
+++ b/user:hugues/Environment.zsh
@@ -35,8 +35,8 @@ export LESS="-R -F -X"
export NULLCMD=cat
# Locale en français unicode
-export LC_ALL=${LC_ALL:-fr_FR.UTF-8}
-export LC_MESSAGES=${LC_MESSAGES:-fr_FR}
+export LC_ALL=${LC_ALL:-br_FR.UTF-8}
+export LC_MESSAGES=${LC_MESSAGES:-br_FR}
unset LANG # Unuseful
# Utilisation des commandes git-*
diff --git a/user:hugues/GusBindings.zsh b/user:hugues/GusBindings.zsh
index b156e68..1d29f50 100644
--- a/user:hugues/GusBindings.zsh
+++ b/user:hugues/GusBindings.zsh
@@ -220,7 +220,7 @@ do
bindkey -M $keymap -s '^[c' '^[Q configure\n'
bindkey -M $keymap -s '^[©' '^[Q !?configure\n'
- alias MAKE="[ ! -e Makefile -a ! -e GNUmakefile ] && ( [ ! -e configure ] && ./autogen.sh ; ./configure && make ) || make"
+ alias MAKE="[ ! -e Makefile -a ! -e GNUmakefile ] && ( [ ! -e configure ] && [ -e autogen.sh ] && ./autogen.sh || [ -e configure.ac ] && autoreconf --install ; ./configure && make ) || make"
bindkey -M $keymap -s '^[m' '^[Q MAKE\n'
bindkey -M $keymap -s '^[M' '^[Q make\n'
diff --git a/zshrc b/zshrc
index 499ad3c..8f57c44 100644
--- a/zshrc
+++ b/zshrc
@@ -43,6 +43,7 @@ DOMAIN=${DOMAIN:-$(hostname -y 2>&-)}
## Agent de clefs SSH/GPG
KEYCHAIN=~/.keychain/$(hostname)-sh
+keychain -q
[ -r "${KEYCHAIN}" ] && source ${KEYCHAIN}
[ -r "${KEYCHAIN}-gpg" ] && source ${KEYCHAIN}-gpg