summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhugues <hugues@a0e5b806-a6f9-0310-978d-cbce73f8a913>2007-05-16 10:17:44 +0000
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:11 +0100
commit72896f1d1d0ae633d360aede3956d42036fd600d (patch)
treea6a94a70c15918a416dae7e8504aea7fb95543ac
parente9962a5ffdc774468cfb3fd09a2dfe03190e5ad2 (diff)
=?utf-8?q?Tout=20plein=20de=20modifs,=20du=20m=C3=A9nage,=20des=20trucs=20en=20plus,
=20plus=20beaux,=20moins=20moches,=20plus=20mieux=20et=20tout=20et=20tout=208-)?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.5.4.1" This is a multi-part message in MIME format. --------------1.5.4.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://hugues@maison/opt/svn/private/hugues@382 a0e5b806-a6f9-0310-978d-cbce73f8a913
-rw-r--r--.zshrc12
-rw-r--r--00_Preamble.zsh32
-rw-r--r--00_Sanity.zsh19
-rw-r--r--01_Functions.zsh (renamed from 80_Functions.zsh)23
-rw-r--r--10_Environment.zsh (renamed from 20_Environment.zsh)12
-rw-r--r--11_Prompts.zsh (renamed from 25_Prompts.zsh)2
-rw-r--r--20_Options.zsh (renamed from 10_Options.zsh)2
-rw-r--r--50_Aliases.zsh65
-rw-r--r--51_Hashes.zsh (renamed from 50_Hashes.zsh)2
-rw-r--r--60_Completion.zsh (renamed from 30_Completion.zsh)2
-rw-r--r--70_Aliases.zsh70
-rw-r--r--80_KeyBindings.zsh0
-rw-r--r--90_DevelUtils.zsh (renamed from 85_Debug.zsh)2
-rw-r--r--99_Exec.zsh (renamed from 99_Start.zsh)2
-rw-r--r--host:paranoid/Aliases.zsh16
-rw-r--r--host:prunelle/Aliases.zsh2
-rw-r--r--host:prunelle/Environment.zsh2
-rw-r--r--net:example.com/Environment.zsh2
-rw-r--r--net:ordener.fr/Aliases.zsh16
-rw-r--r--net:ordener.fr/Environment.zsh (renamed from host:paranoid/Environment.zsh)2
-rw-r--r--user:hugues/KeyBindings.zsh (renamed from 40_KeyBindings.zsh)4
21 files changed, 146 insertions, 143 deletions
diff --git a/.zshrc b/.zshrc
index 3643640..5ff5d81 100644
--- a/.zshrc
+++ b/.zshrc
@@ -23,11 +23,15 @@
ZDOTDIR=${ZDOTDIR:-~/.zsh}
mkdir -p $ZDOTDIR
+# Useful environment variables which may be used
+# at any time - We compute them now to avoid calling
+# the required processes each time we'll need.
USER=${USER:-`whoami`}
-HOST=${HOST:-$(hostname -s 2>/dev/null)}
-DOMAIN=${DOMAIN:-${$(hostname -d 2>/dev/null):-$(hostname -y 2>/dev/null)}}
+UID=${UID:-`id -u`}
+HOST=${HOST:-$(hostname -s)}
+DOMAIN=${DOMAIN:-${$(hostname -d):-$(hostname -y)}}
-export USER HOST DOMAIN
+export USER HOST DOMAIN UID
if [ -d $ZDOTDIR ]; then
for script in $ZDOTDIR/??_*.zsh
@@ -36,7 +40,7 @@ if [ -d $ZDOTDIR ]; then
[ "$DEBUG" != "" ] && echo "${${script:t:r}/??_/}... ";
source $script
- for i in "net:$DOMAIN" "host:$HOST" "user:$USER"
+ for i in "net:$DOMAIN" "host:$HOST" "user:$USER" "user:$SUDO_USER"
do
specific_script=${script:h}/$i/${${script:t}/??_/}
if test -f $specific_script
diff --git a/00_Preamble.zsh b/00_Preamble.zsh
deleted file mode 100644
index 5c28439..0000000
--- a/00_Preamble.zsh
+++ /dev/null
@@ -1,32 +0,0 @@
-##
-## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
-##
-## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
-##
-## You are encouraged to use, modify, and redistribute
-## these files with or without this notice.
-##
-## No more core dumps :)
-ulimit -c 0
-umask 002
-
-##
-## sanity
-##
-[[ -t 0 ]] && /bin/stty erase "^H" intr "^C" susp "^Z" dsusp "^Y" stop "^S" start "^Q" kill "^U" >& /dev/null
-
-
-# Variables utiles
-
- _color_black=\033[30m
- _color_red=\033[31m
- _color_green=\033[32m
- _color_yellow=\033[33m
- _color_blue=\033[34m
-_color_magenta=\033[35m
- _color_cyan=\033[36m
-
- _unset_color=\033[0m
- _color_bold=\033[1m
-_color_underline=\033[4m
diff --git a/00_Sanity.zsh b/00_Sanity.zsh
new file mode 100644
index 0000000..b76865a
--- /dev/null
+++ b/00_Sanity.zsh
@@ -0,0 +1,19 @@
+##
+## 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.
+##
+
+# No more core dumps :)
+ulimit -c 0
+
+# No dangerous world-writeable files & folders
+umask 002
+
+# sanity
+[[ -t 0 ]] && /bin/stty erase "^H" intr "^C" susp "^Z" dsusp "^Y" stop "^S" start "^Q" kill "^U" >& /dev/null
+
diff --git a/80_Functions.zsh b/01_Functions.zsh
index dd6de32..022a87d 100644
--- a/80_Functions.zsh
+++ b/01_Functions.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
@@ -14,7 +14,7 @@ term_title()
case $TERM in
sun-cmd)
print -Pn "\e]l%n@%m %~$1\e\\" ;;
- *xterm*|rxvt*|(k|E|dt)term|gnome-terminal)
+ *term*|rxvt*)
print -Pn "\e]0;%n@%m (%l) %~$1\a" ;;
esac
}
@@ -39,5 +39,22 @@ precmd ()
preexec ()
{
- term_title " $1"
+ term_title " ··· $1"
}
+
+cmd_exists ()
+{
+ which $1 2>/dev/null >&2
+}
+
+normal_user ()
+{
+ eval `grep -v '^[$#]' /etc/login.defs | tr -d '[:blank:]' | sed 's/^[A-Z_]\+/&=/'`
+ test \( $UID -ge $UID_MIN \) -a \( $UID -le $UID_MAX \)
+}
+
+privileged_user ()
+{
+ ! normal_user
+}
+
diff --git a/20_Environment.zsh b/10_Environment.zsh
index 252083a..5360382 100644
--- a/20_Environment.zsh
+++ b/10_Environment.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
@@ -20,7 +20,7 @@
export BC_ENV_ARGS="-q"
## Editeur par défaut
-export EDITOR=`which vim`
+export EDITOR=`which vim || which vi || which emacs`
export VISUAL=$EDITOR
export FCEDIT=$EDITOR
@@ -30,7 +30,7 @@ export PAGER=less
## Quelle commande utiliser par défaut ?
export NULLCMD=cat
-[ `which dircolors` >/dev/null 2>&1 ] && eval $(dircolors ~/.dir_colors 2>&-)
+cmd_exists dircolors && eval $(dircolors ~/.dir_colors 2>&- )
export TZ="Europe/Paris"
export TIME_STYLE="+%Y-%b-%d %H:%M:%S"
@@ -50,10 +50,10 @@ unset LANG # Unuseful
# si et seulement si $VARIABLE contient déjà des choses, cela pour éviter
# d'avoir un PATH (p.e.) de la forme : PATH=:/bin
#
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:~/libs
-export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/X11R6/lib/pkgconfig
+#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:~/libs
+#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/X11R6/lib/pkgconfig
export PATH=$PATH:~/sbin:~/bin
-[ `id -u` -lt 100 ] && PATH=/sbin:/usr/sbin:$PATH
+privileged_user && PATH=/sbin:/usr/sbin:$PATH
export MANPATH=$MANPATH:~/man
export INFOPATH=$INFOPATH:~/info
## Nettoyage des précédentes variables pour supprimer les duplicata
diff --git a/25_Prompts.zsh b/11_Prompts.zsh
index 6c10f8f..aec9f66 100644
--- a/25_Prompts.zsh
+++ b/11_Prompts.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/10_Options.zsh b/20_Options.zsh
index 4d35898..ca0fb85 100644
--- a/10_Options.zsh
+++ b/20_Options.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/50_Aliases.zsh b/50_Aliases.zsh
new file mode 100644
index 0000000..1818c4b
--- /dev/null
+++ b/50_Aliases.zsh
@@ -0,0 +1,65 @@
+##
+## 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.
+##
+alias a='alias'
+
+a -g ¬ISO='LC_ALL=fr_FR'
+a -g ¬UTF='LC_ALL=fr_FR.UTF-8'
+
+a una=unalias
+
+cmd_exists emacsclient && a e='emacsclient'
+cmd_exists emacs && a ne='emacs -nw'
+
+cmd_exists vim && a v='vim'
+
+cmd_exists eject && a close='eject -t'
+
+a rm='rm -i'
+a mv='mv -i'
+a cp && una cp ## Dé-assigne les alias de ``cp''
+autoload zmv
+a mmv='noglob zmv -W'
+
+normal_user && cmd_exists apt-get && a apt-get='sudo apt-get'
+
+a rt='find .* * -prune -type f \( -name "*~" -o -name ".*~" -o -name "#*#" \) -exec rm -vf \{\} \;'
+
+a eg=egrep
+
+a hg='< $HISTFILE cat -n | grep'
+##'hc' stands for something like 'fc' and 'hg'##
+a hc='history 0| grep'
+a lg='ls -lap | grep'
+
+a s='cd ..'
+a so='cd ${OLDPWD}'
+
+a x=exit
+
+a ls='ls -F --color=always'
+a l='ls -lh'
+a ll='ls -l'
+a la='ls -la'
+a lc='ls -c'
+a lm='ls -ma'
+a lc1='\ls -c1'
+
+cmd_exists dict && a definition='dict -h dict.org'
+cmd_exists dict && a traduction='dict -h localhost -P-'
+
+cmd_exists dosbox && a dosbox='dosbox -c "mount c \"`pwd`\"" -c "mount d /cdrom -t cdrom" -c "c:" '
+cmd_exists emacss && a gnus='emacs -f gnus'
+
+#a make='make -j'
+
+## Suffixes Aliases
+cmd_exists editdiff && a -s patch=editdiff
+a -s c=$EDITOR
+a -s h=$EDITOR
diff --git a/50_Hashes.zsh b/51_Hashes.zsh
index 4564729..4dd4cf9 100644
--- a/50_Hashes.zsh
+++ b/51_Hashes.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/30_Completion.zsh b/60_Completion.zsh
index b0104b8..63bffa5 100644
--- a/30_Completion.zsh
+++ b/60_Completion.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/70_Aliases.zsh b/70_Aliases.zsh
deleted file mode 100644
index 40460db..0000000
--- a/70_Aliases.zsh
+++ /dev/null
@@ -1,70 +0,0 @@
-##
-## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
-##
-## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
-##
-## You are encouraged to use, modify, and redistribute
-## these files with or without this notice.
-##
-alias a='alias'
-
-a -g DEVNULL='>/dev/null 2>&1'
-a -g NOTROOT='[ "`whoami`" != "root" ] && '
-
-a -g ASCII='LC_ALL=fr_FR'
-a -g UNICODE='LC_ALL=fr_FR.UTF-8'
-
-a una=unalias
-
-a e='emacsclient'
-a ne='emacs -nw'
-
-a v='vim'
-
-a close='eject -t'
-
-a rm='rm -i'
-a mv='mv -i'
-autoload zmv
-a mmv='noglob zmv -W'
-
-NOTROOT which apt-get DEVNULL && a apt-get='sudo apt-get'
-
-a rt='find . -type f \( -name "*~" -o -name ".*~" -o -name "#*#" \) -exec rm -vf \{\} \;'
-
-a eg=egrep
-
-a hg='< $HISTFILE cat -n | grep'
-##'hc' stands for something like 'fc' and 'hg'##
-a hc='history 0| grep'
-a lg='ls -lap | grep'
-
-a s='cd ..'
-a so='cd ${OLDPWD}'
-
-a x=exit
-
-a ls='ls -F --color=always'
-a l='ls -lh'
-a ll='ls -l'
-a la='ls -la'
-a lc='ls -c'
-a lm='ls -ma'
-a lc1='\ls -c1'
-
-a definition='dict -h dict.org'
-a traduction='dict -h localhost -P-'
-
-a dosbox='dosbox -c "mount c \"`pwd`\"" -c "mount d /cdrom -t cdrom" -c "c:" '
-a gnus='emacs -f gnus'
-
-#a make='make -j'
-
-# Unicode-uncompliant
-#a mutt='ASCII mutt'
-
-## Suffixes Aliases
-a -s patch=editdiff
-a -s c=$EDITOR
-a -s h=$EDITOR
diff --git a/80_KeyBindings.zsh b/80_KeyBindings.zsh
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/80_KeyBindings.zsh
diff --git a/85_Debug.zsh b/90_DevelUtils.zsh
index 8fb3c21..37290a0 100644
--- a/85_Debug.zsh
+++ b/90_DevelUtils.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/99_Start.zsh b/99_Exec.zsh
index dfc4b65..f5af0a7 100644
--- a/99_Start.zsh
+++ b/99_Exec.zsh
@@ -1,6 +1,6 @@
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/host:paranoid/Aliases.zsh b/host:paranoid/Aliases.zsh
deleted file mode 100644
index 330f68d..0000000
--- a/host:paranoid/Aliases.zsh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/zsh
-##
-## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
-##
-## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
-##
-## You are encouraged to use, modify, and redistribute
-## these files with or without this notice.
-##
-
-## Paranoid specifics aliases
-
-a mailstats='mailstat -mo ~/.procmail/procmail.log'
-a mails='mailstat -k ~/.procmail/procmail.log | egrep -v "## .*:" ; cat ~/.procmail/procmail.log >> ~/.procmail/procmail.log.old ; echo -n > ~/.procmail/procmail.log'
-a junkmail='mutt -f ~/Mail/junk.gz'
diff --git a/host:prunelle/Aliases.zsh b/host:prunelle/Aliases.zsh
index 900e335..03b6b3f 100644
--- a/host:prunelle/Aliases.zsh
+++ b/host:prunelle/Aliases.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/host:prunelle/Environment.zsh b/host:prunelle/Environment.zsh
index b96764f..219e88e 100644
--- a/host:prunelle/Environment.zsh
+++ b/host:prunelle/Environment.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/net:example.com/Environment.zsh b/net:example.com/Environment.zsh
index 27997ce..a1345ef 100644
--- a/net:example.com/Environment.zsh
+++ b/net:example.com/Environment.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/net:ordener.fr/Aliases.zsh b/net:ordener.fr/Aliases.zsh
new file mode 100644
index 0000000..dafa07b
--- /dev/null
+++ b/net:ordener.fr/Aliases.zsh
@@ -0,0 +1,16 @@
+#!/bin/zsh
+##
+## 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.
+##
+
+## Paranoid specifics aliases
+
+cmd_exists mailstat && a mailstats='mailstat -mo ~/.procmail/procmail.log'
+cmd_exists mailstat && a mails='mailstat -k ~/.procmail/procmail.log | egrep -v "## .*:" ; cat ~/.procmail/procmail.log >> ~/.procmail/procmail.log.old ; echo -n > ~/.procmail/procmail.log'
+cmd_exists mutt && a junkmail='[ -f ~/Mail/junk.gz ] && mutt -f ~/Mail/junk.gz'
diff --git a/host:paranoid/Environment.zsh b/net:ordener.fr/Environment.zsh
index 07f3bad..6f220db 100644
--- a/host:paranoid/Environment.zsh
+++ b/net:ordener.fr/Environment.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
diff --git a/40_KeyBindings.zsh b/user:hugues/KeyBindings.zsh
index c92a42b..d47fb62 100644
--- a/40_KeyBindings.zsh
+++ b/user:hugues/KeyBindings.zsh
@@ -1,7 +1,7 @@
#!/bin/zsh
##
## Part of configuration files for Zsh 4
-## by Hugues Hiegel <hugues@nullpart.net>
+## by Hugues Hiegel <hugues@hiegel.fr>
##
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
@@ -87,7 +87,7 @@ 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^V" vi-cmd-mode
bindkey "^X^X" exchange-point-and-mark
bindkey "^X*" expand-word
bindkey "^X=" what-cursor-position