+# Simulate hooks using _functions arrays for Zsh versions older than 4.3.4. At
+# the moment only precmd() and preexec() are simulated.
+#
+# At least 4.3.4 (not sure about later versions) has an error in add-zsh-hook
+# so the compatibility version is used there too.
+if [[ $ZSH_VERSION != (4.3.<5->|4.<4->*|<5->*) ]]; then
+ # Provide add-zsh-hook which was added in 4.3.4.
+ fpath=(~/.zsh/functions/compatibility $fpath)
+
+ # Run all functions defined in the ${precmd,preexec}_functions arrays.
+ function precmd() {
+ for function in $precmd_functions; do
+ $function $@
+ done
+ }
+ function preexec() {
+ for function in $preexec_functions; do
+ $function $@
+ done
+ }
+fi
+
+# Autoload add-zsh-hook to add/remove zsh hook functions easily.
+autoload -Uz add-zsh-hook
+
+# Load zmv (zsh move) which is powerful to rename files.
+autoload zmv