prev UP NEXT ne's manual

5.1: Key Bindings

ne allows you to associate to any keystroke any command. In order to accomplish this task, you have to create a file named `.keys' in your home directory, or in `$HOME/.ne'. You can change the default name (possibly specifying a complete path) using the --keys argument (see Arguments).

The format of the file is very simple: each line starting with the `KEY' sequence of capital characters is considered the description of a key binding. All other lines are considered commments. The format of a key binding description is

KEY hexcode command

The hexcode value is the ASCII code of the keystroke. For special keys such as INSERT or function keys, you should take a look at ne's source file `keycodes.h', which contains the codes for all terminfo's key capabilities. You can write just the hex digits, nothing else is necessary (but a prefixing `0x' is tolerated). For instance,

KEY 1 MOVESOL

of a line, while

KEY 101 LINEUP

one line up.

The file `default.keys' which comes with ne's distribution contains a complete, commented definition of ne's standard bindings. You can modify this file with a trial-and-error approach.

command can be any ne command, including Escape (which allows the reconfigure the menu activator) and Macro, which allows to bind complex sequences of actions to a single keystroke. The binding of a macro is very fast because on the first call the macro is cached in memory. See Macro.

Note that you cannot ever redefine RETURN and ESCAPE. This is a basic issue---however brain damaged is the current configuration, you will always be able to exploit fully the menus and the command line.

The key binding file is parsed at startup. If something does not work, ne exits displaying an error message. If you want to skip this phase (for instance, in order to correct the broken file), just give ne the --noconfig argument. See Arguments.


Contact:
vigna@dsi.unimi.it - about ne
bela@www.emerson.emory.edu - about these pages