]> git.siccegge.de Git - dotfiles/zsh.git/blob - includes/FreeBSD.zsh
Fix FreeBSD terminal
[dotfiles/zsh.git] / includes / FreeBSD.zsh
1 # create a zkbd compatible hash;
2 # to add other keys to this hash, see: man 5 terminfo
3 typeset -A key
4
5 key[Home]=${terminfo[khome]}
6 key[End]=${terminfo[kend]}
7 key[Insert]=${terminfo[kich1]}
8 key[Delete]=${terminfo[kdch1]}
9 key[Up]=${terminfo[kcuu1]}
10 key[Down]=${terminfo[kcud1]}
11 key[Left]=${terminfo[kcub1]}
12 key[Right]=${terminfo[kcuf1]}
13 key[PageUp]=${terminfo[kpp]}
14 key[PageDown]=${terminfo[knp]}
15
16 # setup key accordingly
17 [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
18 [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
19 [[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
20 [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
21 [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
22 [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
23 [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
24 [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
25
26 # Finally, make sure the terminal is in application mode, when zle is
27 # active. Only then are the values from $terminfo valid.
28 function zle-line-init () {
29 echoti smkx
30 }
31 function zle-line-finish () {
32 echoti rmkx
33 }
34 zle -N zle-line-init
35 zle -N zle-line-finish