Next: Commentary Up: Interactive Input Editing Previous: History Substitution

Key Bindings

The key bindings and some other parameters of the Readline library can be customized by placing commands in an initialization file called $HOME/.inputrc. Key bindings have the form


key-name: function-name
or


"string": function-name
and options can be set with


set option-name value
For example:


# I prefer vi-style editing:
set editing-mode vi
# Edit using a single line:
set horizontal-scroll-mode On
# Rebind some keys:
Meta-h: backward-kill-word
"\C-u": universal-argument
"\C-x\C-r": re-read-init-file
Note that the default binding for TAB in Python is to insert a TAB instead of Readline's default filename completion function. If you insist, you can override this by putting


TAB: complete
in your $HOME/.inputrc. (Of course, this makes it hard to type indented continuation lines...)


guido@cwi.nl