index

How I bind control keys for work in shell (in terminals)

Have the terminal (emulator) produce distinct key sequences

Have nice bindings: commands of the shell line editor

deleting (backwards), navigation (skip)

getting more keys available!

Zsh resets terminal setting on each prompt (when you start editing), and unsets some special terminal-handled keys, so that they are available to the user to communicate with Shell.

you can see the list of such bindings by:

stty -a

For Xterm i can configure at launch time:

XTerm.*ttyModes: rprnt ^-

for rxvt: you have to recompile :(

#ifndef CRPRNT
# define CRPRNT		'\024'	/* ^R  mmc: i prefer ^R in shell! let's try with ^T */
#else
#warning "mmc forces CRPRNT!"
#undef CRPRNT
# define CRPRNT		'\024'	/* ^R  mmc: i prefer ^R in shell! let's try with ^T */
#endif

Explanation!

Since rxvt-unicode coders couldn't understand this issue (see another heated discussion), i try to explain more:

Terminal emulator, let's call it xterm, and shell are connected with a PTY. Both programs can configure it, via ioctl.

PTY is implemented in kernel, scans the byte stream and implements some rewriting (transcriptions).

To avoid such rewriting, any end of the connection (both xterm & shell) must configure it (sort of STTY).

Xterm constructs the PTY. If it does not configure it immediately (before sending first keystrokes), you might already lose. So, it's sometimes necessary to check, that it doese what you need.

I want Control-R to work reliably, so i want the xterm to configure.

For SSH

I couldn't find a way to influence the remote (sshd) side pty, so i have in zshrc
ttyctl -u
stty rprnt '^T'
ttyctl -f