Skip to content

Commit bc14ba4

Browse files
ah-jwkvam
authored andcommitted
Add delete/yank/paste cell commands (#28)
* Add delete/yank/paste cell commands * Add Insert Cell (Above) commands * Add undo
1 parent 9a3262d commit bc14ba4

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ Shortcuts this extension introduces:
5454
| ----- | ------ |
5555
| G, G | Select First Cell |
5656
| Shift-G | Select Last Cell |
57+
| D, D | Delete Cell |
58+
| Y, Y | Yank (Copy) Cell |
59+
| P | Paste Cell |
60+
| Shift-P | Paste Cell Above |
61+
| O | Insert Cell |
62+
| Shift-O | Insert Cell Above |
63+
| U | Undo Cell Action |
5764

5865
## Prerequisites
5966

src/index.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,41 @@ function activateCellVim(app: JupyterLab, tracker: INotebookTracker): Promise<vo
456456
keys: ['Shift G'],
457457
command: 'select-last-cell'
458458
});
459+
commands.addKeyBinding({
460+
selector: '.jp-Notebook.jp-mod-commandMode',
461+
keys: ['Y', 'Y'],
462+
command: 'notebook:copy-cell'
463+
});
464+
commands.addKeyBinding({
465+
selector: '.jp-Notebook.jp-mod-commandMode',
466+
keys: ['D', 'D'],
467+
command: 'notebook:cut-cell'
468+
});
469+
commands.addKeyBinding({
470+
selector: '.jp-Notebook.jp-mod-commandMode',
471+
keys: ['Shift P'],
472+
command: 'notebook:paste-cell-above'
473+
});
474+
commands.addKeyBinding({
475+
selector: '.jp-Notebook.jp-mod-commandMode',
476+
keys: ['P'],
477+
command: 'notebook:paste-cell-below'
478+
});
479+
commands.addKeyBinding({
480+
selector: '.jp-Notebook.jp-mod-commandMode',
481+
keys: ['O'],
482+
command: 'notebook:insert-cell-below'
483+
});
484+
commands.addKeyBinding({
485+
selector: '.jp-Notebook.jp-mod-commandMode',
486+
keys: ['Shift O'],
487+
command: 'notebook:insert-cell-above'
488+
});
489+
commands.addKeyBinding({
490+
selector: '.jp-Notebook.jp-mod-commandMode',
491+
keys: ['U'],
492+
command: 'notebook:undo-cell-action'
493+
});
459494

460495
// tslint:disable:no-unused-expression
461496
new VimCell(app, tracker);

0 commit comments

Comments
 (0)