繁体   English   中英

禁用Jupyter键盘快捷键

[英]Disable Jupyter Keyboard Shortcuts

我的一个Jupyter笔记本使用了一个html <input>标签,它需要输入用户类型,但每当我输入文本框时,命令模式键盘快捷键就会激活。

是否可以关闭单个单元或笔记本的键盘快捷键?

您可以使用Jupyter.keyboard_manager.disable()暂时禁用快捷方式,并使用Jupyter.keyboard_manager.enable()再次激活。

您可以将此行复制粘贴到custom.js中:

$([IPython.events]).on("app_initialized.NotebookApp", function () {
    ...
    // Starting from this line, replace 'Shift-k' with whatever 
    // shortcut you're trying to remove.
    IPython.keyboard_manager.command_shortcuts.remove_shortcut('Shift-k')
    ...
});

或者您希望删除的任何快捷方式。

资料来源: http//akuederle.com/customize-ipython-keymap/

如果你想要一个示例custom.js这是我的github上的。

根据当前的“自定义键盘映射”文档 ,现在可以使用~/.jupyter/nbconfig/notebook.json文件比hlin117的答案更简单:

例如,要取消绑定快捷方式以在光标位置拆分单元格(Ctrl-Shift-Minus),请使用以下命令:

// file ~/.jupyter/nbconfig/notebook.json
{
  "keys": {
    "edit": {
      "unbind": [
        "Ctrl-Shift-Minus"
      ]
    },
  },
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM