Skip to content

Commit 5211b1d

Browse files
committed
ctrl-j and ctrl-k execute markdown
1 parent 7ecf22a commit 5211b1d

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

History.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# History
22

3+
## 0.4.1 / 2018-02-14
4+
5+
* Ctrl-J and Ctrl-K execute markdown when leaving the cell.
6+
37
## 0.4.0 / 2018-02-13
48

59
* Added Command/Ctrl-{1,2,3} to switch cell mode to code, markdown and raw.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ I hope this extension can meet the high bar his work set.
2727
| Ctrl-Shift-J | Extend Marked Cells Below |
2828
| Ctrl-Shift-K | Extend Marked Cells Above |
2929
| Ctrl-O, O | Insert Cell Below |
30+
| Ctrl-O, Ctrl-O | Insert Cell Above |
3031
| Ctrl-J | Select Cell Below |
3132
| Ctrl-K | Select Cell Above |
3233
| Command/Ctrl-1 | Code Cell Mode |

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab_vim",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "Code cell vim bindings",
55
"author": "Jacques Kvam",
66
"main": "lib/index.js",

src/index.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,34 @@ function activateCellVim(app: JupyterLab, tracker: INotebookTracker): Promise<vo
272272
},
273273
isEnabled
274274
});
275+
commands.addCommand('select-below-execute-markdown', {
276+
label: 'Execute Markdown and Select Cell Below',
277+
execute: args => {
278+
const current = getCurrent(args);
279+
280+
if (current) {
281+
if (current.notebook.activeCell.model.type === 'markdown') {
282+
(current.notebook.activeCell as MarkdownCell).rendered = true;
283+
}
284+
return NotebookActions.selectBelow(current.notebook);
285+
}
286+
},
287+
isEnabled
288+
});
289+
commands.addCommand('select-above-execute-markdown', {
290+
label: 'Execute Markdown and Select Cell Below',
291+
execute: args => {
292+
const current = getCurrent(args);
293+
294+
if (current) {
295+
if (current.notebook.activeCell.model.type === 'markdown') {
296+
(current.notebook.activeCell as MarkdownCell).rendered = true;
297+
}
298+
return NotebookActions.selectAbove(current.notebook);
299+
}
300+
},
301+
isEnabled
302+
});
275303

276304
commands.addKeyBinding({
277305
selector: '.jp-Notebook.jp-mod-editMode',
@@ -337,12 +365,12 @@ function activateCellVim(app: JupyterLab, tracker: INotebookTracker): Promise<vo
337365
commands.addKeyBinding({
338366
selector: '.jp-Notebook.jp-mod-editMode',
339367
keys: ['Ctrl J'],
340-
command: 'notebook:move-cursor-down'
368+
command: 'select-below-execute-markdown'
341369
});
342370
commands.addKeyBinding({
343371
selector: '.jp-Notebook.jp-mod-editMode',
344372
keys: ['Ctrl K'],
345-
command: 'notebook:move-cursor-up'
373+
command: 'select-above-execute-markdown'
346374
});
347375
commands.addKeyBinding({
348376
selector: '.jp-Notebook.jp-mod-editMode',

0 commit comments

Comments
 (0)