Can I setup
less program to exit from it by pressing
To bind Esc+Esc to
lesskey, do the following:
- Create a
~/.lesskeyfile with the line:
lesskey. This will create a binary
~/.lessfile used by
lessas usual. Esc+Esc will do a
If you no longer want your bindings, you can remove the
For more details, see
man lesskey or
lesskey.nro in the
less package source.
Debian -- Details of source package less in wheezy
SYNOPSIS lesskey [-o output] [--] [input] The input file is a text file which describes the key bindings. If the input file is "-", standard input is read. If no input file is specified, a standard filename is used as the name of the input file, which depends on the system being used: On Unix systems, $HOME/.lesskey is used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined.
less has many functions bound to ESC + something else. See the manpage: ESCv, ESCn, ESCF, many others. You wouldn't be able to type any of those is
less exited upon receiving just ESC.
Concievably, you could rebind all those functions to other keystrokes or live with being unable to type them, and rebind ESC to quitting, but it still wouldn't be a good idea.
It's not a good choice of key to use. In VT100 (the terminal emulation used basically everywhere these days) all terminal control sequences begin with the ASCII
ESC character. This means that every time you press something like an arrow key, your terminal sends
ESC followed by other stuff. When you press the ESC key, your terminal also sends
ESC, but it's not followed by anything. How can software tell the difference after having received an ASCII
ESC character? It is forced to wait a some time to see if anything follows the
ESC. So things bound to ESC alone always incur a delay, a time lag before the software can respond.