【概要】
書籍 スッキリわかるPython入門を読みJupyter Labを使い始めたのですが、
Jupyter Notebookのショートカット一覧は調べればすぐ見つかるものの、
Jupyter LabのWindowsショートカット一覧はあまり無く、探すのが大変だったので、個人的備忘も兼ねて下記に記載します。
また、Jyupiter Lab内でのショートカットキー一覧の見方とショートカット割り当ての変更方法も記載します。
【Jupyter Lab ショートカット一覧】
※初期状態の場合
| 内容 | キー割り当て |
|---|---|
| Change to Code Cell Type | Y |
| Change to Heading 1 | 1 |
| Change to Heading 2 | 2 |
| Change to Heading 3 | 3 |
| Change to Heading 4 | 4 |
| Change to Heading 5 | 5 |
| Change to Heading 6 | 6 |
| Change to Markdown Cell Type | M |
| Change to Raw Cell Type | R |
| Clear Outputs | 未割り当て |
| Collapse All Code | 未割り当て |
| Collapse All Outputs | 未割り当て |
| Collapse Selected Code | 未割り当て |
| Collapse Selected Outputs | 未割り当て |
| Copy Cells | C |
| Cut Cells | X |
| Delete Cells | D, D |
| Disable Scrolling for Outputs | 未割り当て |
| Enable Scrolling for Outputs | 未割り当て |
| Expand All Code | 未割り当て |
| Expand All Outputs | 未割り当て |
| Expand Selected Code | 未割り当て |
| Expand Selected Outputs | 未割り当て |
| Extend Selection Above | Shift+K |
| Extend Selection Below | Shift+J |
| Insert Cell Above | A |
| Insert Cell Below | B |
| Merge Selected Cells | Shift+M |
| Move Cells Down | 未割り当て |
| Move Cells Up | 未割り当て |
| Paste Cells Above | 未割り当て |
| Paste Cells and Replace | 未割り当て |
| Paste Cells Below | V |
| Redo Cell Operation | Shift+Z |
| Run Selected Cells | Shift+Enter |
| Run Selected Cells and Don't Advance | Ctrl+Enter |
| Run Selected Cells and Insert Below | Alt+Enter |
| Run Selected Text or Current Line in Console | 未割り当て |
| Select Cell Above | K |
| Select Cell Below | J |
| Split Cell | Ctrl+Shift+- |
| Undo Cell Operation | Z |
【Jupyter Lab内でのショートカット一覧の見方】
Jupyter Labを起動し、左ペインのパレットマークをクリック

検索ボックスに**「notebook cell operations 」**と入力。
すると、ショートカット一覧を見ることができます。

【ショートカットキー割り当ての変更方法】
**「Settings」から、「Advanced Settings Editor」**を選択

すると、下記のような画面に切り替わるので、
右側のUser Preferencesに変更したいキー割り当てを入力し、保存。
(下画像は、ノートブックのセルを消すコマンドを**「D+D」から「Delete」**に変更した場合)
【キー変更方法 詳細】
初期で{ }が上記画像の「User Preferences」ペインに書かれているので、その中に下記の要領で記載していきます。
①"shortcuts": [ ]を入力
②上記の角カッコの中にcommand・keys・selectorを書き入れていく。
※command・selectorは「System Defaults」ペインの中を漁って、変更したいものと同じにすればOK!
keysは他のデフォルトコマンドを見ながら書いていく。
(なお、WindowsにおけるCtrlは「Accel」と表記されているようです。)
ノートブックのセルを消すコマンドを「D+D」から「Delete」に変更したい場合は下記のようになります。
"shortcuts": [
{
"command": "notebook:delete-cell",
"keys": [
"Delete"
],
"selector": ".jp-Notebook:focus"
}
]
以上になります。
Jupyter Labはまだまだ日本語情報が少ないので、
しばらくは手探りで調べる必要がありそうですね。
