+for w in \
+ forward-word backward-word kill-word backward-kill-word \
+ transpose-words capitalize-word up-case-word down-case-word \
+ delete-whole-word select-word
+do
+ autoload -U $w-match
+ zle -N $w-bash $w-match
+ zle -N $w-shell $w-match
+ zstyle ':zle:*-bash' word-style standard
+ zstyle ':zle:*-bash' skip-whitespace-first true
+ zstyle ':zle:*-bash' word-chars ""
+ zstyle ':zle:*-shell' word-style shell
+ zstyle ':zle:*-shell' skip-whitespace-first false
+done
+
+bindkey "\eb" backward-word-bash
+bindkey "\e^b" backward-word-shell
+bindkey "\ef" forward-word-bash
+bindkey "\e^f" forward-word-shell
+bindkey "\e^?" backward-kill-word-bash
+bindkey "^w" backward-kill-word-shell
+bindkey "\ed" kill-word-bash
+bindkey "\e^d" kill-word-shell
+bindkey "\et" transpose-words-bash
+bindkey "\e^t" transpose-words-shell
+bindkey "\eu" up-case-word-bash
+bindkey "\e^u" up-case-word-shell
+bindkey "\el" down-case-word-bash
+bindkey "\e^l" down-case-word-shell
+bindkey "\ec" capitalize-word-bash
+bindkey "\e^c" capitalize-word-shell
+
+bindkey "\e[1~" beginning-of-line "\e[4~" end-of-line
+
+bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
+bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
+bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
+bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
+bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
+
+bindkey -s "\eOQ" "/" "\eOR" "*" "\eOS" "-"
+bindkey -s "\eOw" "7" "\eOx" "8" "\eOy" "9"
+bindkey -s "\eOt" "4" "\eOu" "5" "\eOv" "6" "\eOk" "+"
+bindkey -s "\eOq" "1" "\eOr" "2" "\eOs" "3"
+bindkey -s "\eOp" "0" "\eOn" "."; bindkey "\eOM" accept-line
+
+bindkey "\ep" history-beginning-search-backward
+bindkey "\en" history-beginning-search-forward
+
+setopt interactive_comments
+bindkey "\e#" pound-insert
+
+__mdw_delete_horizontal_space () {
+ LBUFFER=${LBUFFER%%[[:space:]]##}
+ RBUFFER=${RBUFFER##[[:space:]]##}
+}
+zle -N delete-horizontal-space __mdw_delete_horizontal_space
+bindkey "\e\\" delete-horizontal-space
+
+__mdw_just_one_space () {
+ LBUFFER="${LBUFFER%%[[:space:]]##} "
+ RBUFFER=${RBUFFER##[[:space:]]##}
+}
+zle -N just-one-space __mdw_just_one_space
+bindkey "\e " just-one-space
+