davidbrochart / nbterm

Jupyter Notebooks in the terminal.
MIT License
753 stars 37 forks source link

Make keybindings as close to the "real ones" as possible. #4

Open fperez opened 3 years ago

fperez commented 3 years ago

If possible, I'd try to mimic as many of the regular keybindings (Shift-enter for execution, etc) as is possible in the terminal/rich. I know it may not be viable to catch them all, but I think the overall experience for users would be very much improved if the muscle memory translates 1-1 from JupyterLab/Classic to nbterm.

If this sounds reasonable I'm happy to test further which ones can work and which can't...

Pinging @Carreau and @takluyver who have a ton of experience with prompt_toolkit in IPython (that code was added after I'd mostly stopped writing new IPython code) and may have ideas here, as well as being interested in nbterm :)

Keep up the great work, thanks David for this lovely tool!

Carreau commented 3 years ago

Yeah, I think all the Ctrl-Enter, Shift-Enter and everything dealing with enter will be hard if not impossible as Enter and Ctrl-M are indistinguishable at the terminal level and Esc itself does not register an event before the next key is pressed unless the terminal is in Raw Mode, which I'm unsure prompt toolkit does – at least in IPython it does not as it's in REPL mode and not Fullscreen App mode.

So basically moving from Edit to command mode via Enter/Escape might be a really tough sell.

Though I agree I'd like a consistent schortcut experience at least as an option.

davidbrochart commented 3 years ago

I changed the key bindings in version 0.0.5. It's now much closer to the classic Notebook, except for the ones involving shift where I had to find an alternative. nbterm has now more features for editing the notebook, and is also more robust regarding the notebook format. Feedback welcome!