这个问题在GitHub上已经得到解答,点此查看。你还可以在这里查找正确的command
名称,以便在键盘快捷方式中进行用户覆盖,因为它们并不总是与侧边栏中显示的相同。
以下是我使用的一些命令:
{
"shortcuts": [
{
"command": "notebook:hide-cell-outputs",
"keys": [
"O"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:show-cell-outputs",
"keys": [
"O",
"O"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:hide-all-cell-outputs",
"keys": [
"Ctrl L"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:hide-all-cell-code",
"keys": [
"Shift O"
],
"selector": ".jp-Notebook:focus"
}
]
}
按一次O
即可隐藏单元格输出,再按一次O
即可显示单元格输出。最后,按下Shift + O
可折叠所有单元格代码,正如您所要求的那样。
我使用以下设置将单元格向上/向下移动的操作绑定到Ctrl + Up /Down:
{
// Move cell up
"notebook:move-cell-up": {
"selector": ".jp-Notebook:focus",
"command": "notebook:move-cell-up",
"keys": [
"Ctrl ArrowUp"
]
},
// Move cell down
"notebook:move-cell-down": {
"selector": ".jp-Notebook:focus",
"command": "notebook:move-cell-down",
"keys": [
"Ctrl ArrowDown"
]
}
}
结合上面pX0r和plalanne的回答,经过微小的修改,对我很有用,逐步迭代可能对像我这样的初学者有所帮助。总结如下:
command ,
。Ctrl Arrowup
已被保留查看所有运行的应用程序(如果您以这种方式设置它)。同样,Shift Arrowup
用于选择多个单元格。因此,我选择了Alt Arrowup
。请注意,您Mac键盘上的键说alt/option。您必须将其称为Alt
才能起作用。这就是它的全部内容。将以下代码复制到右窗格中的"用户覆盖"中。{
// Move cell up
"notebook:move-cell-up": {
"selector": ".jp-Notebook:focus",
"command": "notebook:move-cell-up",
"keys": [
"Alt ArrowUp"
]
},
// Move cell down
"notebook:move-cell-down": {
"selector": ".jp-Notebook:focus",
"command": "notebook:move-cell-down",
"keys": [
"Alt ArrowDown"
]
}
}
{
"shortcuts": [
{
"command": "application:activate-next-tab",
"keys": [
"Ctrl Shift ]"
],
"selector": "body",
"disabled": true // disable old setting
},
{
"command": "application:activate-previous-tab",
"keys": [
"Ctrl Shift ["
],
"selector": "body",
"disabled": true // disable old setting
},
{
"command": "application:activate-next-tab",
"keys": [
"Ctrl 1" // enable new shortcut key
],
"selector": "body"
},
{
"command": "application:activate-previous-tab",
"keys": [
"Ctrl 2" // enable new shortcut key
],
"selector": "body"
}
]
}