--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/functions/xhashd Fri Jul 20 19:38:28 2012 +0200
@@ -0,0 +1,19 @@
+
+### xhashd(): check for directory, then create hash -d
+# Copied and slightly modified from Franck Terbeck zsh configuration.
+# https://dev.0x50.de/projects/ftzsh/repository
+
+local key val com
+if (( ${#argv} == 0 )) ; then
+ printf 'xhashd(): Missing argument.\n'
+ return 1
+fi
+if (( ${#argv} > 1 )) ; then
+ printf 'xhashd(): Too many arguments %s\n' "${#argv}"
+ return 1
+fi
+
+key="${1%%\=*}" ; val="${1#*\=}"
+val=${val/#\~\//$HOME/}
+[[ -d ${val} ]] && hash -d -- "${key}=${val}"
+return 0
--- a/zshrc.d/05-autoload.zrc Wed Jul 18 21:20:59 2012 +0200
+++ b/zshrc.d/05-autoload.zrc Fri Jul 20 19:38:28 2012 +0200
@@ -7,3 +7,5 @@
# Load standard ANSI color codes in shell parameters
autoload -U colors && colors
+
+autoload -U xhashd