my current keys config is:

typeset -A key


# setup key accordingly
[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"   ]]  && bindkey  "${key[Right]}"   forward-char

# 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 () {
    echoti smkx
function zle-line-finish () {
    echoti rmkx

if [ -n "${DISPLAY:-}" ]; then
   zle -N zle-line-init
   zle -N zle-line-finish

completion and other zsh files here: https://github.com/Cynede/dotfiles/blob/master/.zsh/config.sh

The trouble is that this bindkey "${key[Home]}" beginning-of-line doesn't work for terminal with no Xorg running seems like. It pastes ~ on both HOME and END. How can I make it to work without Xorg too?

  • What do you see when you type Ctrl-V, Home? See also this discussion Commented Jan 29, 2013 at 7:36
  • what I see is ^[[1~
    – cnd
    Commented Jan 29, 2013 at 7:51
  • 1
    What about print -r -- ${(V)terminfo[khome]}? Commented Jan 29, 2013 at 10:07
  • what I see is ^[OH
    – cnd
    Commented Jan 29, 2013 at 10:45

1 Answer 1


The $terminfo special parameter in zsh is filled from data that comes from the terminfo database on your system.

In your case, it seems that the entry in the database for the terminal you're using is incorrect.

The terminfo database is indexed on the value of the $TERM environment variable.

So either $TERM is incorrect or the database is incorrect.

What terminal is that? Is that the console of some BSD operating system? What does $TERM contain? Are you logged in locally or logging in to some remote system (which may have a different terminfo database) over ssh/rsh?

  • True, I were setting wrong TERM right in zsh. Thank you.
    – cnd
    Commented Jan 29, 2013 at 11:22
  • @Heather. OK. I realise I read the comments backward and would now bet that you're on the Linux console and had TERM set to xterm. Note that you should not set $TERM, it should be set by automatically by the terminal emulator or getty (and transfered automatically via ssh/rlogin/rsh). The only time when you might need to change it is if you're rlogging-in to a system that has different settings for a given entry. Commented Jan 29, 2013 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .