如何在 Jupyter Lab 中将键盘快捷键自定义为 运行 当前行或所选文本?
How to customize keyboard shortcuts in Jupyter Lab to run current line or selected text?
我碰巧在 JupyterLab 的 "Run" 菜单下经常使用 "Run Selected Text or Current Line in Console" 命令。我们如何在 JupterLab/Jupyter notebook 中为此配置自定义键盘快捷键?
对于 JupyterLab
转到 Settings
并选择 Advanced Settings editor
。在 Keyboard shortcuts
选项卡下,将整个 System Defaults
内容复制到 User Preferences
列并找到包含以下内容的部分:
"command": "notebook:run-in-console",
"keys": [
""
],
添加您想要的组合键并保存,例如:
"keys": [
"F12"
],
JupterLab 打开后,单击“设置”下拉菜单。 Select 高级设置编辑器。
Select 键盘快捷键。
您会在“系统默认值”面板中看到每个选项的字典。有很多选项,因此您可能需要 Command + F(Windows 上的 Ctrl + F)来找到您想要的选项。复制您要覆盖的代码。
这是 restart-and-运行-all 的部分。
{"shortcuts":
[
{
"command": "runmenu:restart-and-run-all",
"keys": [
"Ctrl Shift R"
],
"selector": "[data-jp-code-runner]"
}
]
}
我建议您通过在系统默认面板中搜索新的组合键来确保您没有覆盖另一个 JupyterLab 键盘快捷键。
你有它。按 Command + S(Windows 上的 Ctrl + S)保存,打开一个笔记本文件,然后试试你的新键盘快捷键!
我碰巧在 JupyterLab 的 "Run" 菜单下经常使用 "Run Selected Text or Current Line in Console" 命令。我们如何在 JupterLab/Jupyter notebook 中为此配置自定义键盘快捷键?
对于 JupyterLab
转到 Settings
并选择 Advanced Settings editor
。在 Keyboard shortcuts
选项卡下,将整个 System Defaults
内容复制到 User Preferences
列并找到包含以下内容的部分:
"command": "notebook:run-in-console",
"keys": [
""
],
添加您想要的组合键并保存,例如:
"keys": [
"F12"
],
JupterLab 打开后,单击“设置”下拉菜单。 Select 高级设置编辑器。 Select 键盘快捷键。 您会在“系统默认值”面板中看到每个选项的字典。有很多选项,因此您可能需要 Command + F(Windows 上的 Ctrl + F)来找到您想要的选项。复制您要覆盖的代码。 这是 restart-and-运行-all 的部分。
{"shortcuts":
[
{
"command": "runmenu:restart-and-run-all",
"keys": [
"Ctrl Shift R"
],
"selector": "[data-jp-code-runner]"
}
]
}
我建议您通过在系统默认面板中搜索新的组合键来确保您没有覆盖另一个 JupyterLab 键盘快捷键。 你有它。按 Command + S(Windows 上的 Ctrl + S)保存,打开一个笔记本文件,然后试试你的新键盘快捷键!