iPython不读取〜/.inputrc [英] iPython does not read ~/.inputrc

查看:99
本文介绍了iPython不读取〜/.inputrc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iPython.文档说,我应该能够使用inputrc重新映射readline库的键.这是我的inputrc中的内容:

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

当我加载iPython时,这些映射根本不起作用.我在OS X 10.9 Mavericks上.我没有看到任何关于正在使用libedit而不是readline的警告.有什么想法吗?

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?

推荐答案

来自

所有这些功能都基于GNU readline库,该库具有一个非常可定制的界面.通常,readline是通过一个文件来配置的,该文件定义了库的行为.有关此语法的详细信息,请参见系统或Internet上提供的readline文档. IPython不会直接读取此文件(如果存在),但确实支持通过一个简单的界面将其传递给readline有效选项.简而言之,您可以通过在配置文件中设置以下选项来自定义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:它包含要通过readline.parse_and_bind()命令执行的字符串的列表.可以通过阅读GNU readline库的文档找到此类有效命令的语法,因为这些命令属于readline在其配置文件中接受的类型.

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:要从readline使用的默认单词定界符列表中删除的字符串,以便可以在包含它们的字符串上执行补全.除非您知道自己在做什么,否则请勿更改默认值.

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生成带有示例的默认配置.

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.

这篇关于iPython不读取〜/.inputrc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆