I am using iPython. The docs says that I should be able to remap the readline library's keys using inputrc. Here is what I have in my inputrc:
set editing-mode emacs
set keymap emacs
Meta-h: backward-word
Meta-s: forward-word
Control-h: backward-char
Control-s: forward-char
Control-n: previous-history
Control-t: next-history
Control-p: yank
Meta-p: yank-pop
These mappings simply do not work when I load iPython. I'm on OS X 10.9 Mavericks. I do not see any warnings that libedit is being used instead of readline. Any ideas?
From the IPython Documentation:
All these features are based on the GNU readline library, which has an extremely customizable interface. Normally, readline is configured via a file which defines the behavior of the library; the details of the syntax for this can be found in the readline documentation available with your system or on the Internet. IPython doesn’t read this file (if it exists) directly, but it does support passing to readline valid options via a simple interface. In brief, you can customize readline by setting the following options in your configuration file (note that these options can not be specified at the command line):
readline_parse_and_bind: this holds a list of strings to be executed via a readline.parse_and_bind() command. The syntax for valid commands of this kind can be found by reading the documentation for the GNU readline library, as these commands are of the kind which readline accepts in its configuration file.
readline_remove_delims: a string of characters to be removed from the default word-delimiters list used by readline, so that completions may be performed on strings which contain them. Do not change the default value unless you know what you’re doing.
So, you have to set readline_parse_and_bind
in the configuration file (by default, this is in /path/to/ipython/dir/profile_default/ipython_config
. You can generate the default config with an example using ipython profile create
.