summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2008-03-05 12:08:11 +0100
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:22 +0100
commit2098491cd2fb0203a8f4e39bf07d077fd2fcc655 (patch)
tree009140519f466d94320b2bd893e78db55782f82c /zshrc
parentdd2537bf9a06c47057bf66061100ed80809cb887 (diff)
=?utf-8?q?D=C3=A9placement=20de=20~/.zshrc=20dans=20~/.zsh/zshrc=20avec=20ln=20-s=20qui=20va=20bien,
=20en=20vue=20d'un=20tracking=20s=C3=A9par=C3=A9=20de=20~/.zsh=20.?= 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
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc78
1 files changed, 78 insertions, 0 deletions
diff --git a/zshrc b/zshrc
new file mode 100644
index 0000000..323188e
--- /dev/null
+++ b/zshrc
@@ -0,0 +1,78 @@
+##
+## THIS FILE IS NOT INTENDED TO BE MODIFIED ! READ ABOVE...
+##
+#
+# Instead, add/edit your configuration files inside $ZDOTDIR.
+#
+# If you want to add a file, name it specifically in the form
+#
+# $ZDOTDIR/??_*.zsh
+#
+# Where "??" should be a two-digit number.
+# With that, file ``10_Toto.zsh'' would be parsed before
+# file ``20_Tutu.zsh'', allowing you ordering your scripts.
+#
+# If you want to make user, host or network specific configurations,
+# add your specific scripts to the folders
+# - "user:$(whoami)" for user-specific conf,
+# - "host:$(hostname -s)" for host-specific conf,
+# - "net:$(domainname)" for network-specific conf,
+# rename your scripts to the form mentionned above, minus the "??_"
+# prefix. An original script prefixed by a two-digits number SHOULD
+# be present on the $ZDOTDIR folder, even if empty.
+#
+
+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`}
+UID=${UID:-`id -u`}
+HOST=${HOST:-$(hostname -s)}
+DOMAIN=${DOMAIN:-${$(hostname -d 2>&-):-$(hostname -y 2>&-)}}
+[ $DOMAIN = "" -o $DOMAIN = "localdomain" -o $DOMAIN = "(none)" ] && DOMAIN=$(grep "^search " /etc/resolv.conf | cut -d' ' -f2)
+
+DEBUG=${DEBUG:-no}
+
+export USER HOST DOMAIN UID
+
+if [ -d $ZDOTDIR ]; then
+ for script in $ZDOTDIR/??_*.zsh
+ do
+
+ [ "$DEBUG" = "yes" ] && echo -n "${${script:t:r}/??_/}... "
+ source $script
+ [ "$DEBUG" = "yes" ] && echo
+
+ for i in "net:$DOMAIN"\
+ "host:$HOST"\
+ "user:$USER"\
+ "user:$SUDO_USER"\
+ "net:$DOMAIN/host:$HOST"\
+ "net:$DOMAIN/user:$USER"\
+ "net:$DOMAIN/user:$SUDO_USER"\
+ "net:$DOMAIN/host:$HOST/user:$USER"\
+ "net:$DOMAIN/host:$HOST/user:$SUDO_USER"\
+ "host:$HOST/user:$USER"\
+ "host:$HOST/user:$SUDO_USER"
+ do
+ specific_script=${script:h}/$i/${${script:t}/??_/}
+ if test -f $specific_script
+ then
+ [ "$DEBUG" = "yes" ] && echo -n "$i/${${specific_script:t:r}/??_/}... ";
+ source $specific_script
+ [ "$DEBUG" = "yes" ] && echo
+ fi
+ done
+ done
+fi
+
+# For sudo shells
+#if [ "$USER" = "root" ]
+#then
+ [ "`pwd`" = ~ ] && cd ~$USER
+ export HOME=~$USER
+#fi
+