+bindkey -M vicmd 'v' edit-command-line
+
+# delay after ESC (in 0.01s)
+export KEYTIMEOUT=40
+
+# fix Home/End keys
+bindkey '^[[7~' beginning-of-line
+bindkey '^[[8~' end-of-line
+
+# emacs bindings
+bindkey '^A' beginning-of-line
+bindkey '^B' backward-char
+bindkey '^E' end-of-line
+bindkey '^F' edit-command-line
+bindkey '^G' list-expand
+bindkey '^O' accept-line-and-down-history
+bindkey '^Q' push-input
+bindkey '^?' backward-delete-char
+bindkey '^H' backward-delete-char
+bindkey '^W' backward-kill-word
+bindkey '^X=' what-cursor-position
+bindkey '^[.' insert-last-word
+bindkey '^[?' which-command
+bindkey '^[A' accept-and-hold
+bindkey '^[a' accept-and-hold
+bindkey '^[C' capitalize-word
+bindkey '^[c' capitalize-word
+bindkey '^[H' run-help
+bindkey '^[h' run-help
+bindkey '^[T' transpose-words
+bindkey '^[t' transpose-words
+
+# make search up and down work, so partially type and hit up/down to find relevant stuff
+bindkey '^[[A' up-line-or-search # up arrow
+bindkey '^[[B' down-line-or-search # down arrow
+bindkey '^[[5~' up-line-or-history # PgUp
+bindkey '^[[6~' down-line-or-history # PgDown
+
+bindkey '^[OA' up-line-or-history
+bindkey '^[OB' down-line-or-history
+bindkey '^[OC' forward-char
+bindkey '^[OD' backward-char
+bindkey '^[OF' end-of-line
+bindkey '^[OH' beginning-of-line
+
+bindkey '\e[c' forward-word
+bindkey '\e[d' backward-word
+