+# KEY BINDINGS
+
+# Not all bindings are done here, only those not specific to a given section.
+
+# Use Vi(m) style key bindings.
+bindkey -v
+
+# Also use jj to exit insert mode.
+bindkey 'jj' vi-cmd-mode
+
+# I don't need the arrow keys, I use ^N and ^P for this (see below).
+bindkey -r '^[OA' '^[OB' '^[OC' '^[OD' '^[[A' '^[[B' '^[[C' '^[[D'
+# Also not in Vi mode.
+bindkey -a -r '^[OA' '^[OB' '^[OC' '^[OD' '^[[A' '^[[B' '^[[C' '^[[D'
+
+
+# FUNCTION SETTINGS
+
+# Make sure every entry in $fpath is unique.
+typeset -U fpath
+# ~/.zsh/functions/completion is a symbolic link to the Completion directory
+# of a Zsh CVS checkout. Use it to get the newest completions if available.
+if [[ -d ~/.zsh/functions/completion ]]; then
+ fpath=(~/.zsh/functions/completion/*/*(/) $fpath)
+fi
+# Set correct fpath to allow loading my functions (including completion
+# functions).
+fpath=(~/.zsh/functions $fpath)
+# Autoload my functions (except completion functions and hidden files). Thanks
+# to caphuso from the Zsh example files for this idea.
+if [[ -d ~/.zsh/functions ]]; then
+ autoload ${fpath[1]}/^_*(^/:t)
+fi
+
+# Simulate hooks using _functions arrays for Zsh versions older than 4.3.4. At
+# the moment only precmd(), preexec() and chpwd() 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,chpwd}_functions
+ # arrays.
+ function precmd() {
+ for function in $precmd_functions; do
+ $function $@
+ done
+ }
+ function preexec() {
+ for function in $preexec_functions; do
+ $function $@
+ done
+ }
+ function chpwd() {
+ for function in $chpwd_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
+
+