如何配置ipython快捷键?

问题描述 投票:0回答:1

我尝试将其添加到我的 ipython 配置中

c.TerminalInteractiveShell.shortcuts = [
    {
        "command": "IPython:auto_suggest.accept",
        "new_keys": ["c-z"],
    }
]

但是 ipython 抱怨说:

ValueError: Multiple shortcuts matching {'command': 'IPython:auto_suggest.accept'} found, please add keys/filter to select one of: [Binding(command=<function accept at 0x7f6fc3aa4ca0>, keys=['c-f'], condition='has_suggestion & default_buffer_focused & emacs_like_insert_mode'), Binding(command=<function accept at 0x7f6fc3aa4ca0>, keys=['right'], condition='has_suggestion & default_buffer_focused & emacs_like_insert_mode')]

该文档对于该主题并不十分详细,或者我还没有找到合适的地方来查看...

ipython config
1个回答
0
投票

“对于已经有快捷方式的命令,您需要使用

match_keys
而不是
new_keys
”:

c.TerminalInteractiveShell.shortcuts = [
    {
        "command": "IPython:auto_suggest.accept",
        "match_keys": ["c-z"],
    }
]

参见:https://github.com/ipython/ipython/issues/14117

© www.soinside.com 2019 - 2024. All rights reserved.