Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #333 from meeseeksmachine/auto-backport-of-pr-330-…
Browse files Browse the repository at this point in the history
…on-0.3.x

Backport PR #330 on branch 0.3.x (Add `Accel Enter` shortcut to execute a cell)
  • Loading branch information
jtpio authored Jan 27, 2022
2 parents 3470287 + a328c19 commit 27fbff9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/notebook-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,28 @@ const kernelStatus: JupyterFrontEndPlugin<void> = {
}
};

/**
* A plugin to add an extra shortcut to execute a cell in place via Cmd-Enter on Mac.
* TODO: switch to settings define menus when fixed upstream: https://github.com/jupyterlab/jupyterlab/issues/11754
*/
const runShortcut: JupyterFrontEndPlugin<void> = {
id: '@retrolab/notebook-extension:run-shortcut',
autoStart: true,
activate: (app: JupyterFrontEnd) => {
app.commands.addKeyBinding({
command: 'notebook:run-cell',
keys: ['Accel Enter'],
selector: '.jp-Notebook:focus'
});

app.commands.addKeyBinding({
command: 'notebook:run-cell',
keys: ['Accel Enter'],
selector: '.jp-Notebook.jp-mod-editMode'
});
}
};

/**
* A plugin to enable scrolling for outputs by default.
* Mimic the logic from the classic notebook, as found here:
Expand Down Expand Up @@ -319,6 +341,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
checkpoints,
kernelLogo,
kernelStatus,
runShortcut,
scrollOutput
];

Expand Down

0 comments on commit 27fbff9

Please sign in to comment.