Use terminfo for key bindings.
This commit is contained in:
parent
7754a18d13
commit
d9774e1129
51
keyboard.zsh
51
keyboard.zsh
|
@ -13,35 +13,36 @@ autoload -Uz edit-command-line
|
||||||
zle -N edit-command-line
|
zle -N edit-command-line
|
||||||
|
|
||||||
# Use human-friendly identifiers.
|
# Use human-friendly identifiers.
|
||||||
|
zmodload zsh/terminfo
|
||||||
typeset -g -A keys
|
typeset -g -A keys
|
||||||
keys=(
|
keys=(
|
||||||
'Control' '\C-'
|
'Control' '\C-'
|
||||||
'Escape' '\e'
|
'Escape' '\e'
|
||||||
'Meta' '\M-'
|
'Meta' '\M-'
|
||||||
'F1' '^[OP'
|
'F1' "${terminfo[kf1]}"
|
||||||
'F2' '^[OQ'
|
'F2' "${terminfo[kf2]}"
|
||||||
'F3' '^[OR'
|
'F3' "${terminfo[kf3]}"
|
||||||
'F4' '^[OS'
|
'F4' "${terminfo[kf4]}"
|
||||||
'F5' '^[[15~'
|
'F5' "${terminfo[kf5]}"
|
||||||
'F6' '^[[17~'
|
'F6' "${terminfo[kf6]}"
|
||||||
'F7' '^[[18~'
|
'F7' "${terminfo[kf7]}"
|
||||||
'F8' '^[[19~'
|
'F8' "${terminfo[kf8]}"
|
||||||
'F9' '^[[20~'
|
'F9' "${terminfo[kf9]}"
|
||||||
'F10' '^[[21~'
|
'F10' "${terminfo[kf10]}"
|
||||||
'F11' '^[[23~'
|
'F11' "${terminfo[kf11]}"
|
||||||
'F12' '^[[24~'
|
'F12' "${terminfo[kf12]}"
|
||||||
'Backspace' '^?'
|
'Backspace' "${terminfo[kbs]}"
|
||||||
'Insert' '^[[2~'
|
'Insert' "${terminfo[kich1]}"
|
||||||
'Home' '^[[H'
|
'Home' "${terminfo[khome]}"
|
||||||
'PageUp' '^[[5~'
|
'PageUp' "${terminfo[kpp]}"
|
||||||
'Delete' '^[[3~'
|
'Delete' "${terminfo[kdch1]}"
|
||||||
'End' '^[[F'
|
'End' "${terminfo[kend]}"
|
||||||
'PageDown' '^[[6~'
|
'PageDown' "${terminfo[knp]}"
|
||||||
'Up' '^[[A'
|
'Up' "${terminfo[kcuu1]}"
|
||||||
'Left' '^[[D'
|
'Left' "${terminfo[kcub1]}"
|
||||||
'Down' '^[[B'
|
'Down' "${terminfo[kcud1]}"
|
||||||
'Right' '^[[C'
|
'Right' "${terminfo[kcuf1]}"
|
||||||
'Menu' '^[[29~'
|
'BackTab' "${terminfo[kcbt]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ "$KEYMAP" == (emacs|) ]]; then
|
if [[ "$KEYMAP" == (emacs|) ]]; then
|
||||||
|
@ -228,7 +229,7 @@ bindkey "${keys[Escape]}e" expand-cmd-path
|
||||||
bindkey "${keys[Escape]}m" copy-prev-shell-word
|
bindkey "${keys[Escape]}m" copy-prev-shell-word
|
||||||
|
|
||||||
# Bind Shift + Tab to go to the previous menu item.
|
# Bind Shift + Tab to go to the previous menu item.
|
||||||
bindkey '^[[Z' reverse-menu-complete
|
bindkey "${keys[BackTab]}" reverse-menu-complete
|
||||||
|
|
||||||
# Complete in the middle of word.
|
# Complete in the middle of word.
|
||||||
bindkey "${keys[Control]}i" expand-or-complete-prefix
|
bindkey "${keys[Control]}i" expand-or-complete-prefix
|
||||||
|
|
Loading…
Reference in a new issue