marimo
marimo copied to clipboard
Better keyboard shortcut for cell navigation & manipulation
Description
Currently, keyboard shortcuts in marimo is a bit cumbersome, with uncomfortable positioned keys for frequent things, and some keys missing.
Here are some keyboard shortcuts I find unsatisfying:
- for focus up/down:
ctrl+shift+9/0I think it's used very often, thus shouldn't be this far from home row - for focus top/bottom:
ctrl+shift+f/gIt only move the focus to the first/last cell, but will not scroll the page to top/bottom - for delete cell, pause cell execution: missing
Suggested solution
I'm thinking about keymap of the jupyter plugin of vscode.
That is, like a modal editor, we can have normal mode and insert mode for cells. Quote from the jupyter plugin's doc:
a cell can be in three states: unselected, command mode, and edit mode. ... In command mode, a solid vertical bar will appear to the left of the cell. The cell can be operated on and accepts keyboard commands. In edit mode, a solid vertical bar is joined by a border around the cell editor. The cell's contents (code or Markdown) can be modified.
Then we can avoid that annoying ctrl+shift, and just use a in command mode to add new cell below, or directly use arrow keys/hjkl to navigate between cells in command mode, for example.
I think it will make code editing experience in marimo much better.
Alternative
Not sure how difficult to implement the things above, and I can think of two, maybe easier, alternatives.
Improve code editing experience in vscode plugin
I think currently, we are missing mainly the ability to auto fill boilerplate code, especially these global var dependencies and returns
@app.cell
def __(np):
x=np.linspace(0,1,20)
return x,
Additionally, it will be even better to have a jupyter-like cell view to edit code, even without all the reactivity.
Assign better (near homerow) shortcuts to most used actions
I'm mainly talking about focus up/down: ctrl+shift+9/0. I feel that it's used much more than move cells up/down: ctrl+shift+j/k, while the latter have a much better shortcut.
Additional context
Again, thanks for your awesome work! It makes my playing with data much more fun :)
@proItheus, once again, thanks so much for the great suggestions! Keep them coming :)
The modal editor is interesting. I can totally see how it enables you to be very productive (it's why I like vim). Ultimately it would be great to support more keymaps, of which a modal editor like the one you describe could be one.
Assign better (near homerow) shortcuts to most used actions I'm mainly talking about focus up/down: ctrl+shift+9/0. I feel that it's used much more than move cells up/down: ctrl+shift+j/k, > while the latter have a much better shortcut
This we can easily do. I think you're right. I will add a PR for this today.
Improve code editing experience in vscode plugin
This will take a bit more work. I totally see why it's valuable, as people have gotten used to editing Jupyter notebooks in VSCode. We will update our prioritization of the VSCode editor, based on your feedback.
Again, thanks for your awesome work! It makes my playing with data much more fun :)
You're very welcome! I'm very glad to hear you're enjoying marimo, and I really appreciate your thoughtful feature requests, suggestions, and bug reports. Please keep them coming!