Disable Jupyter Keyboard Shortcuts

好久不见. 提交于 2019-12-05 07:40:50

You could copy paste this line into your 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')
    ...
});

Or whatever shortcut you wish to remove.

Source: http://akuederle.com/customize-ipython-keymap/

If you want a sample custom.js, this is mine on my github.

You can use Jupyter.keyboard_manager.disable() to disable the shortcuts temporarily, and use Jupyter.keyboard_manager.enable() to activate again.

As per the current 'Customize keymaps' docuemntation, this can now be done using the ~/.jupyter/nbconfig/notebook.json file more simply than hlin117's answer:

For example, to unbind the shortcut to split a cell at the position of the cursor (Ctrl-Shift-Minus)use the following:

// file ~/.jupyter/nbconfig/notebook.json
{
  "keys": {
    "edit": {
      "unbind": [
        "Ctrl-Shift-Minus"
      ]
    },
  },
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!