fastai / nbdev-vscode

MIT License
41 stars 5 forks source link

Jupyter keyboard shortcuts for interrupt, restart, expand selection, and merge #20

Open seeM opened 1 year ago

seeM commented 1 year ago

The above-mentioned keyboard shortcuts from Jupyter are missing in VSCode even with the vscode-jupyter-keymap extension.

There's an open PR to add interrupt and restart to vscode-jupyter-keymap but it seems to be stale, so maybe we can add these to the nbdev extension?

Below is the JSON I'm currently using. I think we just need to add it to package.json under key contributes.keybindings.

Let me know what you think. I'm happy to make the PR.

  {
    "key": "i i",
    "command": "jupyter.interruptkernel",
    "when": "notebookEditorFocused && !inputFocus"
  },
  {
    "key": "0 0",
    "command": "jupyter.restartkernel",
    "when": "notebookEditorFocused && !inputFocus"
  },
  {
    "key": "shift+m",
    "command": "notebook.cell.joinBelow",
    "when": "notebookEditorFocused && !inputFocus"
  },
  {
    "key": "shift+m",
    "command": "notebook.cell.joinSelected",
    "when": "notebookEditorFocused && !inputFocus && listMultiSelection"
  },
  {
    "key": "shift+j",
    "command": "list.expandSelectionDown",
    "when": "listFocus && listSupportsMultiselect && !inputFocus"
  },
  {
    "key": "shift+k",
    "command": "list.expandSelectionUp",
    "when": "listFocus && listSupportsMultiselect && !inputFocus"
  },
hamelsmu commented 1 year ago

You don't have to ask me permission to do a PR lol. of course! How do these key bindings work BTW? Is there a "command mode" that you enter into before using these bindings?

hamelsmu commented 1 year ago

If you make a PR add docs to the README.