[Fix #563] Control+Arrow keys are not in the terminfo database

This commit is contained in:
Sorin Ionescu 2014-10-09 13:04:30 -04:00
parent 36ade25eb6
commit 9b1f39f267
1 changed files with 33 additions and 31 deletions

View File

@ -28,33 +28,35 @@ WORDCHARS='*?_-.[]~&;!#$%^(){}<>'
zmodload zsh/terminfo zmodload zsh/terminfo
typeset -gA key_info typeset -gA key_info
key_info=( key_info=(
'Control' '\C-' 'Control' '\C-'
'Escape' '\e' 'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd'
'Meta' '\M-' 'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc'
'Backspace' "^?" 'Escape' '\e'
'Delete' "^[[3~" 'Meta' '\M-'
'F1' "$terminfo[kf1]" 'Backspace' "^?"
'F2' "$terminfo[kf2]" 'Delete' "^[[3~"
'F3' "$terminfo[kf3]" 'F1' "$terminfo[kf1]"
'F4' "$terminfo[kf4]" 'F2' "$terminfo[kf2]"
'F5' "$terminfo[kf5]" 'F3' "$terminfo[kf3]"
'F6' "$terminfo[kf6]" 'F4' "$terminfo[kf4]"
'F7' "$terminfo[kf7]" 'F5' "$terminfo[kf5]"
'F8' "$terminfo[kf8]" 'F6' "$terminfo[kf6]"
'F9' "$terminfo[kf9]" 'F7' "$terminfo[kf7]"
'F10' "$terminfo[kf10]" 'F8' "$terminfo[kf8]"
'F11' "$terminfo[kf11]" 'F9' "$terminfo[kf9]"
'F12' "$terminfo[kf12]" 'F10' "$terminfo[kf10]"
'Insert' "$terminfo[kich1]" 'F11' "$terminfo[kf11]"
'Home' "$terminfo[khome]" 'F12' "$terminfo[kf12]"
'PageUp' "$terminfo[kpp]" 'Insert' "$terminfo[kich1]"
'End' "$terminfo[kend]" 'Home' "$terminfo[khome]"
'PageDown' "$terminfo[knp]" 'PageUp' "$terminfo[kpp]"
'Up' "$terminfo[kcuu1]" 'End' "$terminfo[kend]"
'Left' "$terminfo[kcub1]" 'PageDown' "$terminfo[knp]"
'Down' "$terminfo[kcud1]" 'Up' "$terminfo[kcuu1]"
'Right' "$terminfo[kcuf1]" 'Left' "$terminfo[kcub1]"
'BackTab' "$terminfo[kcbt]" 'Down' "$terminfo[kcud1]"
'Right' "$terminfo[kcuf1]"
'BackTab' "$terminfo[kcbt]"
) )
# Set empty $key_info values to an invalid UTF-8 sequence to induce silent # Set empty $key_info values to an invalid UTF-8 sequence to induce silent
@ -206,10 +208,10 @@ bindkey -d
# Emacs Key Bindings # Emacs Key Bindings
# #
for key ("$key_info[Escape]"{B,b}) bindkey -M emacs "$key" emacs-backward-word for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
for key ("$key_info[Escape]"{F,f}) bindkey -M emacs "$key" emacs-forward-word bindkey -M emacs "$key" emacs-backward-word
bindkey -M emacs "$key_info[Escape]$key_info[Left]" emacs-backward-word for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
bindkey -M emacs "$key_info[Escape]$key_info[Right]" emacs-forward-word bindkey -M emacs "$key" emacs-forward-word
# Kill to the beginning of the line. # Kill to the beginning of the line.
for key in "$key_info[Escape]"{K,k} for key in "$key_info[Escape]"{K,k}