Readline Init File Syntax

The GNU Readline library provides the command line on which you type to communicate with bash and some other GNU utilities. It is amazingly configurable, but most people are not aware of this.

Table A-22, emacs Mode Commands, and Table A-24 are a subset of what is available to work with. See the Readline documentation for the full details.

The following is adapted directly from Chet Ramey’s documentation (http://tiswww.tis.case.edu/~chet/readline/readline.html).

You can modify the run-time behavior of Readline by altering the values of variables in Readline using the set command within the init file. The syntax is simple:

set variable value

Here, for example, is how to change from the default Emacs-like key binding to use vi line-editing commands:

set editing-mode vi

Variable names and values, where appropriate, are recognized without regard to case. Unrecognized variable names are ignored.

Boolean variables (those that can be set to on or off) are set to on if the value is null or empty, on (case-insensitive), or 1. Any other value results in the variable being set to off.

Table A-22. Readline configuration settings

Variable

Description

bell-style

Controls what happens when Readline wants to ring the terminal bell. If set to none, Readline never rings the bell. If set to visible, Readline uses a visible bell if one is available. If set to audible (the default), Readline attempts to ring the terminal’s bell.

bind-tty-special-chars

If set to on, Readline attempts to ...

Get bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.