Conditional Init Constructs; Sample Init File - Red Hat ENTERPRISE LINUX 3 - DEBUGGING WITH GDB Manual

Debugging with gdb
Hide thumbs Also See for ENTERPRISE LINUX 3 - DEBUGGING WITH GDB:
Table of Contents

Advertisement

Chapter 29. Command Line Editing

29.3.2. Conditional Init Constructs

Readline implements a facility similar in spirit to the conditional compilation features of the C pre-
processor which allows key bindings and variable settings to be performed as the result of tests. There
are four parser directives used.
$if
The
construct allows bindings to be made based on the editing mode, the terminal being
$if
used, or the application using Readline. The text of the test extends to the end of the line; no
characters are required to isolate it.
mode
The
mode=
mode. This may be used in conjunction with the
set bindings in the
out in
emacs
term
The
term=
key sequences output by the terminal's function keys. The word on the right side of the
tested against both the full name of the terminal and the portion of the terminal name before
the first
. This allows
-
application
The
application
using the Readline library sets the
value. This could be used to bind key sequences to functions useful for a specific program.
For instance, the following command adds a key sequence that quotes the current or previous
word in Bash:
$if Bash
# Quote the current or previous word
"\C-xq": "\eb\"\ef\""
$endif
$endif
This command, as seen in the previous example, terminates an
$else
Commands in this branch of the
$include
This directive takes a single filename as an argument and reads commands and bindings from
that file. For example, the following directive reads from
$include /etc/inputrc

29.3.3. Sample Init File

Here is an example of an
tional syntax.
# This file controls the behaviour of line input editing for
form of the
directive is used to test whether Readline is in
$if
emacs-standard
mode.
form may be used to include terminal-specific key bindings, perhaps to bind the
to match both
sun
construct is used to include application-specific settings. Each program
directive are executed if the test fails.
$if
file. This illustrates key binding, variable assignment, and condi-
inputrc
set keymap
and
keymaps only if Readline is starting
emacs-ctlx
and
sun
sun-cmd
application name
/etc/inputrc
command, for instance, to
, for instance.
, and you can test for a particular
command.
$if
:
299
or
emacs
vi
is
=

Advertisement

Table of Contents
loading

Table of Contents