ipython中的括号匹配 [英] bracket matching in ipython
问题描述
是否可以选择在IPython中自动关闭括号,引号,括号等?
Is there an option to automatically close brackets,quotes, parentheses etc in IPython?
我希望有一个类似于gedit插件的功能。
I hoped there was a feature similar to that in the gedit plugin.
推荐答案
当通过调整打开括号时,可以使用readline自动添加右括号的应用程序(包括IPython)您的〜/ .inputrc,如此处所示,例如通过添加:
(:\ Cv()\ e [D
It is possible to get apps (including IPython) that use readline to automatically add a closing parenthesis when an open parenthesis is typed by tweaking your ~/.inputrc, as suggested here, e.g. by adding: "(": "\C-v()\e[D"
请注意,根据IPython的创建者无法在基于简单的readline的情况下完成自动括号匹配应用程序(即在正常的IPython终端会话中)。虽然它已经是IPython的qtconsole的标准功能的一部分(尽管下面评论的括号目前无法自动关闭)。
Note that according to the creator of IPython automatic bracket matching can't be done in a plain readline-based application (i.e in a normal IPython terminal session). Though it's already part of the standard functionality of IPython's qtconsole (Although as commented below auto-closing of brackets is not currently possible).
这篇关于ipython中的括号匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!