Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate the key bindings for executing code in various scenarios #1461

Open
petetronic opened this issue Oct 2, 2023 · 7 comments
Open
Labels
area: notebooks Issues related to Notebooks category.

Comments

@petetronic
Copy link
Collaborator

petetronic commented Oct 2, 2023

Jupyter Notebook:
Shift + Enter -> runs code, advances cursor focus to next cell
Cmd + Enter -> runs code, keeps cursor focused where it is
Option + Enter -> runs code, inserts new cell
Run selected text (No key binding, but a menu option. This is not common.)

Quarto will match this Jupyter Notebook behavior, but we also need an execute line based keyboard shortcut. TBD: Can we steal Option + Enter?

VSCode Jupyter:
Shift + Enter -> runs cell, advances cursor focus to next cell
Cmd + Enter -> currently does nothing (but should do the same as ctrl)
Ctrl + Enter -> runs code cell, keeps focus where it is

RStudio Quarto Visual Editor:
Cmd + Enter -> runs the line, goes to next line in same cell
Cmd + Shift + Enter -> runs the entire cell, focus stays in the same cell
Option + Cmd + N -> runs the next chunk

RStudio Editor:
Cmd + Shift + Enter: -> Runs the whole file

VSCode Python Jupyter-Like Cell:
Shift + Enter -> Runs cell, sends output to Interactive Terminal, creates new cell and advances focus.
Cmd + Enter -> Nothing, just inserts new line
Ctrl + Enter -> Runs cell, sends output to Interactive Terminal, leaves focus in current cell.

VSCode Python Extension:
Shift + Enter -> keyboard has been taken over, but should have been Run line/selection in Terminal

Positron Editor:
Cmd + Enter -> sends line/selection to Console
Shift + Enter -> sends line
Cmd + Shift + Enter -> source file to Terminal

Positron Python Jupyter-like Cell:
Cmd + Enter -> Sends line/selection to Console
Ctrl + Enter -> Runs cell an sends result to Interactive Window
Shift + Enter -> Sends line/selection to Console
Cmd + Shift + Enter -> Sources python file in Console (Positron)

@petetronic
Copy link
Collaborator Author

Changes:

Quarto:
One option may be to keep Shift + Enter to run the whole cell and advances to next cell.
But we could take over Cmd + Enter to just mean execute the current line and advance the code line but stay in same cell?

@petetronic petetronic added this to the Release Candidate milestone Feb 20, 2024
@wesm wesm added the area: notebooks Issues related to Notebooks category. label Feb 29, 2024
@GitHunter0

This comment has been minimized.

@juliasilge

This comment has been minimized.

@GitHunter0

This comment has been minimized.

@jaredlander
Copy link

Another option from RStudio that I love is alt+enter which runs the current line but does not advance the cursor to the next line. Trying to add that myself in my keybindings but can't figure out the right command. I'm having trouble figuring out if it is in workbench,action.* or positron.* or something else. I tried looking up where ctrl+enter is defined to learn from that, but can't quite figure out where that is specified for langId == 'r' as I don't see it in the default keybindings.

@jaredlander
Copy link

And...I just realized I opened #2778 and I never saw @juliasilge mentioning that it is hard to untangle the commands right now. But I guess this shows how much I hope it is possible one day.

@juliasilge
Copy link
Contributor

Yep @jaredlander unfortunately we don't have those two pieces (execute, then advance) separated out right now so that they can be bound to keybindings separately. Thank you for this feedback about its importance, though! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: notebooks Issues related to Notebooks category.
Projects
None yet
Development

No branches or pull requests

5 participants