This short howto explains how to figure out which key binding is connected with which key.
I just read a post about zsh and once again was curious about the possibilities and the advantages of that shell. The author provided a customized
.zshrc which I used for tests. And despite the good intentions of the author it was almost unusable.
One reason for that was that the key bindings weren’t right: when I pressed the DEL key a new char “~” appeared instead of another one deleted. POS1 and END keys also just produces more “~” chars. This was due to the fact that the key bindings for the keys were set to the wrong keys:
bindkey '^[OF' end-of-line simply didn’t work for me.
So I had to figure out the right key binding – this is easily done by calling
cat and afterwards press the key which key binding you’d like to have. For me it was
^[[4~, and I used it to replace the
^[OF from above. It worked, and now the appropriate keys work on my system as well with:
# the "del" key
bindkey '\e[3~' delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[4~' end-of-line
bindkey '\e[2~' overwrite-mode