Go to the previous, next section.

Readline Init Syntax

There are only four constructs allowed in the `~/.inputrc' file:

Variable Settings
You can change the state of a few variables in Readline. You do this by using the set command within the init file. Here is how you would specify that you wish to use Vi line editing commands:

set editing-mode vi

Right now, there are only a few variables which can be set; so few in fact, that we just iterate them here:

The editing-mode variable controls which editing mode you are using. By default, GNU Readline starts up in Emacs editing mode, where the keystrokes are most similar to Emacs. This variable can either be set to emacs or vi.

This variable can either be set to On or Off. Setting it to On means that the text of the lines that you edit will scroll horizontally on a single screen line when they are larger than the width of the screen, instead of wrapping onto a new screen line. By default, this variable is set to Off.

This variable when set to On, says to display an asterisk (`*') at the starts of history lines which have been modified. This variable is off by default.

If this variable is set to On it means to use a visible bell if one is available, rather than simply ringing the terminal bell. By default, the value is Off.

  • Key Bindings The syntax for controlling keybindings in the `~/.inputrc' file is simple. First you have to know the name of the command that you want to change. The following pages contain tables of the command name, the default keybinding, and a short description of what the command does.

    Once you know the name of the command, simply place the name of the key you wish to bind the command to, a colon, and then the name of the command on a line in the `~/.inputrc' file. The name of the key can be expressed in different ways, depending on which is most comfortable for you.

    keyname: function-name or macro
    keyname is the name of a key spelled out in English. For example:
    Control-u: universal-argument
    Meta-Rubout: backward-kill-word
    Control-o: ">&output"

    In the above example, C-u is bound to the function universal-argument, and C-o is bound to run the macro expressed on the right hand side (that is, to insert the text `>&output' into the line).

    "keyseq": function-name or macro
    keyseq differs from keyname above in that strings denoting an entire key sequence can be specified. Simply place the key sequence in double quotes. GNU Emacs style key escapes can be used, as in the following example:

    "\C-u": universal-argument
    "\C-x\C-r": re-read-init-file
    "\e[11~": "Function Key 1"

    In the above example, C-u is bound to the function universal-argument (just as it was in the first example), C-x C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~ is bound to insert the text `Function Key 1'.

  • Go to the previous, next section.