if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then function zle-line-init() { echoti smkx }; zle -N zle-line-init function zle-line-finish() { echoti rmkx }; zle -N zle-line-finish fi # PageUp/PageDown (( ${+terminfo[kpp]} )) && bindkey -- "${terminfo[kpp]}" up-line-or-history (( ${+terminfo[knp]} )) && bindkey -- "${terminfo[knp]}" down-line-or-history # Up/Down if (( ${+terminfo[kcuu1]} )) && (( ${+terminfo[kcud1]} )); then autoload -Uz up-line-or-beginning-search; zle -N up-line-or-beginning-search autoload -Uz down-line-or-beginning-search; zle -N down-line-or-beginning-search bindkey -- "${terminfo[kcuu1]}" up-line-or-beginning-search bindkey -- "${terminfo[kcud1]}" down-line-or-beginning-search fi # Home/End (( ${+terminfo[khome]} )) && bindkey -- "${terminfo[khome]}" beginning-of-line (( ${+terminfo[kend]} )) && bindkey -- "${terminfo[kend]}" end-of-line # Shift-Tab (( ${+terminfo[kcbt]} )) && bindkey -- "${terminfo[kcbt]}" reverse-menu-complete # Delete (( ${+terminfo[kdch1]} )) && bindkey -- "${terminfo[kdch1]}" delete-char # Ctrl-Delete (( "${+terminfo[kDC5]}" )) && bindkey -- "${terminfo[kDC5]}" kill-word # Ctrl-RightArrow/LeftArrow (( "${+terminfo[kRIT5]}" )) && bindkey -- "${terminfo[kRIT5]}" forward-word (( "${+terminfo[kLFT5]}" )) && bindkey -- "${terminfo[kLFT5]}" backward-word # Space - don't do history expansion bindkey ' ' magic-space # VV in vi mode to edit cmd autoload -Uz edit-command-line zle -N edit-command-line bindkey -M vicmd 'vv' edit-command-line