marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.34k stars 156 forks source link

Multi-mode Vim support like Jupyterlab-Vim #931

Open anjiro opened 3 months ago

anjiro commented 3 months ago

Description

Jupyterlab-Vim adds a "Jupyterlab Command Mode" which enables manipulation at the cell level. It's super nice and I'd love to see it implemented in Marimo.

Suggested solution

Here's what Jupyterlab-Vim lists (copied verbatim):


Please note that all keys are lowercase unless Shift is explicitly indicated. For example, Y, Y is two lowercase ys, Shift-Y, Y is one uppercase Y followed by a lowercase y.

Shortcuts this extension introduces:

Vim Ex commands

Command Action
:w[rite] Save Notebook
:q[uit] Enter Jupyter command mode

Vim command bindings

Chord Action
Ctrl-O, U Undo Cell Action
- Split Cell at Cursor
Ctrl-O, - Split Cell at Cursor
Ctrl-O, D Cut Cell
Ctrl-O, Y Copy Cell
Ctrl-O, P Paste Cell
Ctrl-Shift-J Extend Marked Cells Below
Ctrl-Shift-K Extend Marked Cells Above
Ctrl-O, O Insert Cell Below
Ctrl-O, Ctrl-O Insert Cell Above
Ctrl-J Select Cell Below
Ctrl-K Select Cell Above
Ctrl-O, G Select First Cell
Ctrl-O, Ctrl-G Select Last Cell
Ctrl-E Move Cell Down
Ctrl-Y Move Cell Up
Ctrl-O, Z, Z Center Cell
Ctrl-G Show Tooltip
Command/Ctrl-1 Code Cell Mode
Command/Ctrl-2 Markdown Cell Mode
Command/Ctrl-3 Raw Cell Mode
Shift-Escape Leave Vim Mode
Escape, Ctrl-[ Exit Vim Insert Mode

Jupyter command bindings

Chord Action
G, G Select First Cell
Shift-G Select Last Cell
D, D Delete Cell
Y, Y Yank (Copy) Cell
P Paste Cell
Shift-P Paste Cell Above
O Insert Cell
Shift-O Insert Cell Above
U Undo Cell Action
Ctrl-E Move Cells Down
Ctrl-Y Move Cells Up
Z, Z Center Cell
Z, C Hide Code Cell
Z, O Show Code Cell
Z, M Hide All Code Cells
Z, R Show All Code Cells

Alternative

No response

Additional context

No response

akshayka commented 3 months ago

Thanks for the feature request! I've used these bindings in the past, and they are nice.

Unfortunately we likely won't get to this soon, just because of a backlog of other tasks ahead of us. But I will keep this open for the future, and so that others can :+1: it if they'd also like to see these bindings implemented.