dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

keybindings.zsh (1350B)


      1 # KEYBINDINGS
      2 typeset -A key
      3 
      4 key[Home]=${terminfo[khome]}
      5 key[End]=${terminfo[kend]}
      6 key[Insert]=${terminfo[kich1]}
      7 key[Delete]=${terminfo[kdch1]}
      8 key[Up]=${terminfo[kcuu1]}
      9 key[Down]=${terminfo[kcud1]}
     10 key[Left]=${terminfo[kcub1]}
     11 key[Right]=${terminfo[kcuf1]}
     12 key[PageUp]=${terminfo[kpp]}
     13 key[PageDown]=${terminfo[knp]}
     14 
     15 [[ -n "${key[Home]}"     ]]  && bindkey  "${key[Home]}"     beginning-of-line
     16 [[ -n "${key[End]}"      ]]  && bindkey  "${key[End]}"      end-of-line
     17 [[ -n "${key[Insert]}"   ]]  && bindkey  "${key[Insert]}"   overwrite-mode
     18 [[ -n "${key[Delete]}"   ]]  && bindkey  "${key[Delete]}"   delete-char
     19 [[ -n "${key[Up]}"       ]]  && bindkey  "${key[Up]}"       up-line-or-history
     20 [[ -n "${key[Down]}"     ]]  && bindkey  "${key[Down]}"     down-line-or-history
     21 [[ -n "${key[Left]}"     ]]  && bindkey  "${key[Left]}"     backward-char
     22 [[ -n "${key[Right]}"    ]]  && bindkey  "${key[Right]}"    forward-char
     23 [[ -n "${key[PageUp]}"   ]]  && bindkey  "${key[PageUp]}"   beginning-of-buffer-or-history
     24 [[ -n "${key[PageDown]}" ]]  && bindkey  "${key[PageDown]}" end-of-buffer-or-history
     25 
     26 if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
     27 	function zle-line-init () {
     28 		printf '%s' "${terminfo[smkx]}"
     29 	}
     30 	function zle-line-finish () {
     31 		printf '%s' "${terminfo[rmkx]}"
     32 	}
     33 	zle -N zle-line-init
     34 	zle -N zle-line-finish
     35 fi