我正在使用iPython.文档说我应该能够使用inputrc重新映射readline库的密钥.这是我在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
加载iPython时,这些映射根本不起作用.我是OS X 10.9 Mavericks.我没有看到任何警告使用libedit而不是readline.有任何想法吗?
解决方法:
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.
因此,您必须在配置文件中设置readline_parse_and_bind(默认情况下,这位于/ path / to / ipython / dir / profile_default / ipython_config.您可以使用ipython profile create生成默认配置示例.