1 # create a zkbd compatible hash;
2 # to add other keys to this hash, see: man 5 terminfo
3 # http://zshwiki.org/home/zle/bindkeys
7 key[Home]=${terminfo[khome]}
8 key[End]=${terminfo[kend]}
9 key[Insert]=${terminfo[kich1]}
10 key[Delete]=${terminfo[kdch1]}
11 key[Up]=${terminfo[kcuu1]}
12 key[Down]=${terminfo[kcud1]}
13 key[Left]=${terminfo[kcub1]}
14 key[Right]=${terminfo[kcuf1]}
15 key[PageUp]=${terminfo[kpp]}
16 key[PageDown]=${terminfo[knp]}
18 # setup key accordingly
19 [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
20 [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
21 [[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
22 [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
23 [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
24 [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
25 [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
26 [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
28 # Finally, make sure the terminal is in application mode, when zle is
29 # active. Only then are the values from $terminfo valid.
30 function zle-line-init () {
33 function zle-line-finish () {
37 zle -N zle-line-finish