ipython: 更改匹配括号的语法高亮颜色

ipython: change syntax highlighting color for matching parenthesis

我在 Debian 10

上使用 ipython 5.8.0

下面的截图显示了普通命令的颜色,当我的光标移动到括号和匹配的括号时的命令被突出显示:

这个配色方案很不幸。我在哪里可以更改它?

在您的终端中,单击“编辑”>“配置文件首选项”>“颜色”

查看文本和背景颜色。

您可以创建 ipython 配置文件(如果不存在)并更改主题

检查 ipython_config.py 是否出现在 ~/.ipython/profile_default/ 下,如果没有,那么你可以 运行 这个命令来创建它

ipython profile create

在您喜欢的任何编辑器中打开 ipython_config.py 文件并取消注释并根据需要更新这些选项

c.InteractiveShell.color_info = True

c.InteractiveShell.colors = 'Linux'

c.TerminalInteractiveShell.highlighting_style = 'monokai'

c.TerminalInteractiveShell.highlight_matching_brackets = True

您可以创建 ipython 配置文件(如果不存在)并覆盖样式

检查 ipython_config.py 是否出现在 ~/.ipython/profile_default/ 下,如果没有,那么您可以 运行 这个命令来创建它

ipython profile create

在您喜欢的任何编辑器中打开 ipython_config.py 文件并取消注释并更新此选项

from pygments.token import Token
c.TerminalInteractiveShell.highlighting_style_overrides = {
    Token.MatchingBrackets.Other  : '#FF00FF', # nested brackets color
    Token.MatchingBracket.Other   : '#FF00FF', # bracket color
    Token.MatchingBracket.Cursor  : '#4b3588', # on cursor over bracket color
    Token.MatchingBrackets.Cursor : '#4b3588', # on cursor over nested matching brackets color
}

对于内置令牌检查 here, for Styling info check here

我是怎么认识的ipython uses pygments for customization check here