-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
swap Shift/Ctrl Enter to match VS Code? #363
base: main
Are you sure you want to change the base?
Conversation
We will match keyboard shortcuts with VS Code for the defaults - what is the default there? |
VSCode's default Shift+Enter is indeed "execute-cell-and-move", which matches Juno and Jupyter and is backwards from Pluto. Ctrl+Enter is "send-line-to-REPL-and-move" which doesn't exist in any of Juno/Jupyter/Pluto so I'd say is kind of moot, and otherwise there's no default binding for "execute-cell-without-moving". So in terms of how to "execute-cell-and-move" and "execute-cell-without-moving", with this PR you match 1 VSCode default and both in Jupyter/Juno, whereas without it you don't match any for VSCode, Jupyter, or Juno, so I do think its the right choice. |
Good stuff. Does this make shift-enter "run and move to cell below" (Jupyter default) or "run and insert cell below"? I think Jupyter has:
Prob should match them by default no? |
How about notebook mode in VS Code - what are the shortcuts there? Try |
VSCode notebook mode (thankfully) seems to match Jupyter, so Ctrl-Enter is run cell (don't move) and Shift-Enter is run cell and move to cell below.
Shift-Enter in this PR stays run and insert cell below, which is indeed slightly different than Jupyter/etc..., but I think this is the right choice, I agree with @fonsp here:
|
Can someone with a mac keyboard find out whether the shortcut to run a cell in VS Code notebook mode is |
@Pocket-titan do you still have access to a mac? With VS Code? |
Yup, I can test in ~30 mins |
Yeah, in VS Code notebook mode on mac ctrl-enter is the default for run-cell (and don't move). Nonetheless cmd-enter on mac (the jupyter default) seems more natural to me - since usually on mac cmd replaces ctrl. On ObservableHQ on mac - and I think Mike Bostock is, or at least was, a mac user: cmd-enter is run and insert below (and if you immediately deselect the new inserted cell it is deleted - which is nice) which seems good to me (edit: ... too, if we're not going to match Jupyter - though I guess that is the behaviour before this PR, modulo ctrl/cmd on mac?) |
@fonsp Here's a list of all the default notebook-related shortcuts on Mac, should you ever need them. Both Legend: |
So we have: VS Code
Hm... Following earlier discussion, "Execute and select below" is less necessary in a reactive notebook, so we map it to "Execute and insert below". This gives us: Pluto?
I think that inserting a cell without executing it still useful in a reactive notebook, and this shortcut was asked for a couple of times. Hmmmm... I feel like "Execute cell" is the most important one, and on Windows and Linux this should be a 2-key combination. What to do now... |
For completeness I'll post this: Jupyter
Why did VS Code change the Windows shortcut 😥 |
cmd+enter is run cell in Jupyter/Juno on mac - not ctrl+enter Generally things that are mapped to ctrl+... on other operating systems, become cmd+... on mac |
I'm on Mac and both CTRL+Enter and CMD+Enter evaluate the cell "in-place" for me. However, CMD+Enter annoyingly adds an empty line to the end of the cell I'm evaluating which is why I always use CTRL+Enter.
Note that Shift+Enter on both Mac and Windows also inserts a cell below if there is none to select. I'm using Jupyter notebooks for years now and I've almost never used Alt+Enter because of this feature. In any case, based on the tables above the current Pluto defaults seem to clearly go against the main pattern here. So +1 for switching the behaviour of CTRL+Enter and Shift+Enter. |
Sorry if I'm too curious, but I wonder a bit why this simple though impactful change takes >7 months to happen (no offense meant). Also, it seems intransparent why this PR/issue, somewhat confusingly, was closed on the 30th of Dec (without reason?) and only reopened months later. Would be great if someone from the Pluto team could comment on (hopefully not if but) when we will get the correct order of CTRL+Enter and Shift-Enter. (Of course, this can wait until after PlutoCon 😄) |
As mentioned by @tbenst here, currently Ctrl+Enter and Shift+Enter are backwards compared to the suggestion by @fonsp here, which means they are unfortunately also backwards to Jupyter/Juno.
Since I'm guessing many of us are coming from Jupyter in particular and I don't see any great reason to swap them, this puts them back.