[英]Disable Jupyter Keyboard Shortcuts
One of my Jupyter notebooks uses an html <input>
tag that expects typed user input, but whenever I type in the text box, command mode keyboard shortcuts activate. 我的一个Jupyter笔记本使用了一个html <input>
标签,它需要输入用户类型,但每当我输入文本框时,命令模式键盘快捷键就会激活。
Is it possible to turn off keyboard shortcuts for a single cell or notebook? 是否可以关闭单个单元或笔记本的键盘快捷键?
您可以使用Jupyter.keyboard_manager.disable()
暂时禁用快捷方式,并使用Jupyter.keyboard_manager.enable()
再次激活。
You could copy paste this line into your custom.js: 您可以将此行复制粘贴到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/ 资料来源: http : //akuederle.com/customize-ipython-keymap/
If you want a sample custom.js
, this is mine on my github. 如果你想要一个示例custom.js
, 这是我的github上的。
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: 根据当前的“自定义键盘映射”文档 ,现在可以使用~/.jupyter/nbconfig/notebook.json
文件比hlin117的答案更简单:
For example, to unbind the shortcut to split a cell at the position of the cursor (Ctrl-Shift-Minus)use the following: 例如,要取消绑定快捷方式以在光标位置拆分单元格(Ctrl-Shift-Minus),请使用以下命令:
// file ~/.jupyter/nbconfig/notebook.json
{
"keys": {
"edit": {
"unbind": [
"Ctrl-Shift-Minus"
]
},
},
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.