1
0
Fork 0
pull/563-control-arrow-key-bindings
Sorin Ionescu 10 years ago
parent 7823bb9985
commit c2d6b378a6

@ -29,8 +29,6 @@ zmodload zsh/terminfo
typeset -gA key_info typeset -gA key_info
key_info=( key_info=(
'Control' '\C-' 'Control' '\C-'
'ControlLeft' '\e[1;5D \e[5D \e\e[D' # sequences from Debian's inputrc
'ControlRight' '\e[1;5C \e[5C \e\e[C'
'Escape' '\e' 'Escape' '\e'
'Meta' '\M-' 'Meta' '\M-'
'Backspace' "^?" 'Backspace' "^?"
@ -59,11 +57,16 @@ key_info=(
'BackTab' "$terminfo[kcbt]" 'BackTab' "$terminfo[kcbt]"
) )
# additionally from Debian's inputrc # Escape sequences from Debian's inputrc.
if [[ "$TERM" = *rxvt* ]]; then key_info+=(
key_info[ControlLeft]+=' \eOd' 'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd'
key_info[ControlRight]+=' \eOc' 'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc'
fi )
# if [[ "$TERM" == rxvt* ]]; then
# key_info[ControlLeft]+=' \eOd'
# key_info[ControlRight]+=' \eOc'
# fi
# 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
# bindkey failure. # bindkey failure.
@ -214,11 +217,9 @@ bindkey -d
# Emacs Key Bindings # Emacs Key Bindings
# #
for key ("${(s: :)key_info[ControlLeft]}" \ for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
"$key_info[Escape]"{B,b} "$key_info[Escape]$key_info[Left]")
bindkey -M emacs "$key" emacs-backward-word bindkey -M emacs "$key" emacs-backward-word
for key ("${(s: :)key_info[ControlRight]}" \ for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
"$key_info[Escape]"{F,f} "$key_info[Escape]$key_info[Right]")
bindkey -M emacs "$key" emacs-forward-word bindkey -M emacs "$key" emacs-forward-word
# Kill to the beginning of the line. # Kill to the beginning of the line.

Loading…
Cancel
Save