Go to the first, previous, next, last section, table of contents.
In this chapter we shall see how the menus and the key bindings of ne
can
be completely configured. Note that the configuration is parsed at startup
time, and cannot be changed during the execution of the program. This is a
chosen limitation.
It should also be remarked that the standard configuration of ne
does
not contain key bindings relative to the Meta key. This choice was forced
by the fact that the behaviour of this key is unpredictable on most systems. If
your Meta key does what it should (i.e., it rises the high bit of any
character), you can configure about thirty new shortcuts--the
Control-Meta-letter combinations--that will produce
ASCII characters between 128 and 159, and will be parsed as shortcuts by
ne
.
ne
allows you to associate any keystroke with any command. To
accomplish this task, you have to create a file named `.keys' in your
home directory, or in `~/.ne'. You can change the default name
(possibly specifying a complete path) using the --keys
argument
(see section 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 the file `default.keys' that comes with ne
's
distribution: it contains a complete, commented definition of
ne
's standard bindings that you can modify with a trial-and-error
approach.) You can write just the hexadecimal digits, nothing else is
necessary (but a prefixing `0x' is tolerated). For instance,
KEY 1 MOVESOL
binds to Control-A the action of moving to the start of a line, while
KEY 101 LINEUP
binds to the "cursor-up" key the action of moving the cursor one line up.
command can be any ne
command, including Escape
(which allows reconfiguring the menu activator) and Macro
, which
allows binding 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 section 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 ne
to skip
parsing the key binding file (for instance, to correct the broken
file), just give ne
the --noconfig
argument. See section Arguments.
ne
allows you to change the contents of its menus. To
accomplish this task, you have to create a file named `.menus' in your
home directory, or in `~/.ne'. You can change the default name
(possibly specifying a complete path) using the --menus
argument
(see section Arguments).
Each line of a menu configuration file not starting with the `MENU' or `ITEM' keywords is considered a comment. You should describe the menus as in the following example:
MENU "File" ITEM "Open... ^O" Open ITEM "Close " Close ITEM "DoIt " Macro DoIt
In other words: a line of this form
MENU "title"
will start the definition of a new menu, having the given title. Each line of the form
ITEM "text" command
will then define a menu item, and associate the given command to it.
Any number of menus can be accomodated, but you should consider that many terminals are 80 column wide. There is also a minor restriction on the items--their width has to be constant throughout each menu (but different menus can have different widths). Note that the text of an item, as the name of a menu, is between quotes. Whatever follows the last quote is considered the command associated to the menu.
Warning: the description of key bindings in menus
(`^O' in the previous example) is very important for the beginner;
there is no relation inside ne
about what you say in the menu and how
you configure the key bindings (see section Key Bindings). Please do not say
things in the menus that are not true in the key binding file.
The menu configuration file is parsed at startup. If something does not
work, ne
exits displaying an error message. If you want ne
to
skip the menu configuration phase (for instance, to correct the
broken file), just give ne
the --noconfig
argument.
See section Arguments.
Go to the first, previous, next, last section, table of contents.