簡體   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