# /etc/zshrc: system-wide .zshrc file for zsh(1). # # This file is sourced only for interactive shells. It # should contain commands to set up aliases, functions, # options, key bindings, etc. # # Global Order: zshenv, zprofile, zshrc, zlogin typeset -A key key[Home]=${terminfo[khome]} key[End]=${terminfo[kend]} key[Insert]=${terminfo[kich1]} key[Delete]=${terminfo[kdch1]} key[Up]=${terminfo[kcuu1]} key[Down]=${terminfo[kcud1]} key[Left]=${terminfo[kcub1]} key[Right]=${terminfo[kcuf1]} key[PageUp]=${terminfo[kpp]} key[PageDown]=${terminfo[knp]} # setup key accordingly [[ -n "${key[Home]}" ]] && bindkey -e "${key[Home]}" beginning-of-line [[ -n "${key[End]}" ]] && bindkey -e "${key[End]}" end-of-line [[ -n "${key[Insert]}" ]] && bindkey -e "${key[Insert]}" overwrite-mode [[ -n "${key[Delete]}" ]] && bindkey -e "${key[Delete]}" delete-char [[ -n "${key[Up]}" ]] && bindkey -e "${key[Up]}" up-line-or-history [[ -n "${key[Down]}" ]] && bindkey -e "${key[Down]}" down-line-or-history [[ -n "${key[Left]}" ]] && bindkey -e "${key[Left]}" backward-char [[ -n "${key[Right]}" ]] && bindkey -e "${key[Right]}" forward-char unset key # Finally, make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. function zle-line-init () { emulate -L zsh printf '%s' $terminfo[smkx] } function zle-line-finish () { emulate -L zsh printf '%s' $terminfo[rmkx] } zle -N zle-line-init zle -N zle-line-finish