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-nameor
"string": function-nameand options can be set with
set option-name valueFor 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-fileNote 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: completein your $HOME/.inputrc. (Of course, this makes it hard to type indented continuation lines...)