Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bindkey

Hi Pierpaolo,
yesterday i solved the same problem on my wife's computer. I do not use these keys,
as they are quite distant (i prefer control/meta combinations).

So you have got some keys, which do not do what you expect. Let's bind them to
what we want. But what are the codes of the keys?

Ask the zsh what coded these keys produce: 
you> type: M-x (M- stands for meta or alt key  -x means contemporary press the letter x)
zsh> says: execute:_
you> type: describe-key-briefly
zsh> says: Describ key briefly: _
you> press the key which bothers you. e.g Home
zsh> says:  "^[[1" is undefined-key

but you want it to go to the beginning of the line, so you must bind it:

    bindkey "^[[1" beginning-of-line
Note that ^[ is 1 character (escape), so you must quote it (i do it in emacs).

after this the key will do what you want, but it still insert the ~. So I think
that describe-key-briefly did not report all the key sequence. Let's append it
    bindkey "^[[1~" beginning-of-line
Now it works!
Do the same with other keys. Well you need to consult some guide to know the
names of functions ... sorry

extract from ~/.zprofile:

bindkey "[1~" beginning-of-line
bindkey "[4~" end-of-line
bindkey "[3~" delete-char


Messages sorted by: Reverse Date, Date, Thread, Author