For those whose editor/pager of choice is not Emacs and who are not entirely satisfied with the --vi-keys option (@xref{--vi-keys}), GNU Info provides a way to define different key-to-command bindings and variable settings from the defaults described in this document.
On startup, GNU Info looks for a configuration file in the invoker's
HOME directory called `.info'(7) variable is not defined, Info
additionally looks in the current directory.}. If it is present, and
appears to contain Info configuration data, and was created with the
current version of the infokey
command, then Info adopts the
key bindings and variable settings contained therein.
The `.info' file contains compact, non-textual data for reasons of
efficiency and because its design was lifted wholesale from the GNU Less
program, which also does it that way. It must be created by compiling a
textual source file using the infokey
command.
@command{infokey} compiles a source file (`$HOME/.infokey'(8) is undefined.} by default) containing Info customizations into a binary format (`$HOME/.info' by default). GNU Info reads the binary file at startup to override the default key bindings and variable definitions. Synopsis:
infokey [option...] [input-file]
Besides the standard @option{--help} and @option{--version}, the only option is @option{--output file}. This tells @command{infokey} to write the binary data to file instead of `$HOME/.info'.
The format of the source file read by @command{infokey} is most easily illustrated by example. For instance, here is a sample `.infokey' source file suitable for aficionados of @command{vi} or @command{less}:
#info j next-line k prev-line l forward-char h backward-char \kd next-line \ku prev-line \kr forward-char \kl backward-char \ scroll-forward \kD scroll-forward-page-only b scroll-backward \kU scroll-backward-page-only g beginning-of-node \kh beginning-of-node G end-of-node \ke end-of-node \t select-reference-this-line - history-node n next-node p prev-node u up-node t top-node d dir-node #var scroll-step=1
The source file consists of one or more sections. Each section starts with a line that identifies the type of section. Possible sections are:
#info
#info
by itself. If this is the first section in the source
file, the #info
line can be omitted. The rest of this section
consists of lines of the form:
string whitespace action [ whitespace [ # comment ] ] newlineWhitespace is any sequence of one or more spaces and/or tabs. Comment is any sequence of any characters, excluding newline. string is the key sequence which invokes the action. action is the name of an Info command. The characters in string are interpreted literally or prefixed by a caret (
^
) to indicate a control
character. A backslash followed by certain characters specifies input
keystrokes as follows:
\b
\e
\n
\r
\t
\ku
\kd
\kl
\kr
\kU
\kD
\kh
\ke
\kx
\mx
#echo-area
#echo-area
by itself. The rest of this section has a syntax
identical to that for the key definitions for the Info area, described
above.
#var
#var
by itself. Following this line is a list of variable
assignments, one per line. Each line consists of a variable name
(See section 11. Manipulating Variables,) followed by =
followed by a value.
There may be no white space between the variable name and the =
,
and all characters following the =
, including white space,
are included in the value.
Blank lines and lines starting with #
are ignored, except for
the special section header lines.
Key bindings defined in the `.info' file take precedence over GNU
Info's default key bindings, whether or not `--vi-keys' is used. A
default key binding may be disabled by overriding it in the `.info'
file with the action invalid
. In addition, all default
key bindings can be disabled by adding this line anywhere in the
relevant section:
#stop
This will cause GNU Info to ignore all the default key commands for that section.
Beware: #stop
can be dangerous. Since it disables all default
key bindings, you must supply enough new key bindings to enable all
necessary actions. Failure to bind any key to the quit
command,
for example, can lead to frustration.
The order in which key bindings are defined in the `.info' file is
not important, except that the command summary produced by the
get-help-window
command only displays the first key that
is bound to each command.
Go to the first, previous, next, last section, table of contents.