Nikos Chantziaras <rea...@gmail.com> wrote: > On 10/07/15 18:00, Gevisz wrote: >> bindkey '^[[7~' beginning-of-line # Home (xterm) >> bindkey '^[[8~' end-of-line # End (xterm) > > lol... are these guys serious? > > It's 2015...
... and yet the way of handling special keys in terminals has not changed: You cannot rely on any special sequence, since it depends on the terminal type (and changes also nowadays, depending on whether you use xterm, screen, tmux, linux console, ...). This is the reason why any fixed default can be wrong: What works in one terminal can break in another. The zsh way of doing this dynamically is much superior to the bash way of doing this statically in a fixed readline config file (which works only because *gentoo* provided a file which works for *most* linux terminals - I also had serious problems with bash and such keys when ssh-ing to e.g. sun stations; with zsh these problems are easily fixable). One way to avoid the multiterm difficulty is to use the terminfo database of your current terminal. In zsh you do this as follows: bindkey ${terminfo[khome]} beginning-of-line bindkey ${terminfo[kend]} end-of-line (Yes, in zsh you usually do not have to quote variabeles!). Note, however, that the above sets the keys only to your *current* terminal. If you call e.g. tmux later on and move your session to another terminal or you login from another terminal, you might again have problems, so it might be a good idea to set some sequences also for other terminals. Again, I recommend you to use zshrc-mv from the mv overlay where all this (and much more) is done.