Pluto.jl
Pluto.jl copied to clipboard
Keyboard only use
Which keys? | Action | |
---|---|---|
β | F1 or Ctrl+Shift+? |
List shortcuts |
β | Shift+Enter |
Run cell |
β | Ctrl+Enter |
Run cell if the code changed and add a new cell below |
β | Ctrl+S |
Run all cells with modified code in a single batch |
β | Tab |
Autocomplete |
β | Backspace or Delete |
Delete empty cell (delete code manually first) |
β | PageUp /Fn+Up and PageDown /Fn+Down |
Edit cell above/below |
β | Ctrl+Q |
Interrupt all cells |
β | Ctrl+P |
Export to PDF |
βͺ | Ctrl+Z but it's tricky |
Undo delete cell |
β | Ctrl+K |
Fold/unfold cell |
β | Alt+Up and Alt+Down |
Move line(s) up/down |
β | Ctrl/Cmd+A , then Alt+Up and Alt+Down |
Move cell(s) up/down |
βͺ | Ctrl+Shift+S |
Move notebook file |
β | Ctrl+/ or Cmd+/ |
Comment/uncomment selection |
βͺ | TBD | Wrap in begin ... end |
βͺ | TBD | Wrap in let ... end |
β | Ctrl/Cmd+C and Ctrl/Cmd+V |
Cut, copy & paste cell(s) |
βͺ | TBD | Add cell without running |
β | Ctrl +primary click |
Jump to definition |
βͺ | TBD |
I'm interested to hear suggestions on which Actions still need a shortcut (I will add them to the list), and which keys to use in case we have not yet decided upon one. If a key has already been decided, you will have to wait for #56 until you can use your alternative keybinding - it's not productive to post them here.
We will use the same shortcuts as the VS Code default keybindings wherever possible - please consider this in your suggestion.
Same shortcuts as VS Code wherever possible.
One of the nice things about Jupyter imho is the ability to switch between command and cell mode by doing Esc/Enter, and then simple shortcuts for creating/deleting cells, moving cells etc in command mode. Would it be an option to have this in Pluto?
Hey! I am very reluctant to add a second editor mode π¬. Part of Pluto's UI design is having all primary functionality (edit, run, add, delete, move and hide) directly available, at the position on your screen where it takes effect.
Now if I read this correctly I currently can't move between cells using the keyboard (but that will be added as per the list above) and I can't add a new cell without re-running an existing cell or re-order cells with a keyboard shortcut?
No worries! I added the last one to the TODO list. π
Rereading the list above I think the only thing missing is the ability to create a new cell without running anything (although maybe that's actually pointless as Ctrl+Enter
does this as long as a cell hasn't changed?)
Added
Also - can someone with a Mac keyboard explain when shortcuts should use Command and when they should use Control? Should any existing shortcuts be different?
It would be really cool to support Jupyter-like single-letter keybindings (inspired by Vim), like o
for new cell below, O
for new cell above. For this however, it needs a modal state (command/insert).
@fonsp on a Mac, it's preferred to use CTRL shortcuts for nested apps since CMD shortcuts are usually system or application specific (in this case the application is the browser). Otherwise you need to find the subset of available keys for all kinds of browsers, which might be difficult.
Another reason why modal editing would be nice. It's usually done by two trigger keys (ESC to enter command mode and i
to enter insert mode). When ESC is pressed, every key has a specific meaning, like x
to delete a cell or as mentioned above o
or O
for new cell below/above. I guess you know this already but just in case :wink:
Edit: oh, I just read that you don't like modal editors. :disappointed: I read https://dl.acm.org/doi/pdf/10.1145/2212877.2212896 but I completely disagree. It's a matter of taste, I only use modal editing including my window manager, browser, mail, jupyter etc. :wink: nevertheless, I might invest time to make a PR in future if you consider to merge such a feature implemented by others?
Thanks for the clarification about CMD!
I won't implement a modal editor right now (even if it is from a PR), but you can move your comment to #56. Once there is the possibility to customise shortcuts, we can also work on implementing an optional vim mode.
Pluto seems awesome. Most exciting development since Hydrogen / VScode Python Interactive. Some humble suggestions on keyboard shortcuts.
keymaps that are out of spec
Ctrl+Enter to run cell Shift+Enter to run cell and add cell below.
-
Based on https://github.com/fonsp/Pluto.jl/issues/56#issuecomment-608520571 and https://github.com/fonsp/Pluto.jl/issues/56#issuecomment-612507279 it seems like current (v0.11.6) ctrl/shift-enter does not match design.
-
ctrl-up/down: not functional right now?
unintuitive
-
Pgup/Pgdown: it's unfortunate to break the basic behavior of a key that works so consistently across the Internet. Current behavior is also substantially different from VScode. I use this all the time to scan through long notebooks. Perhaps ctrl-alt-up/down, or alt-pgup/pgdown instead?
-
ctrl-z: very helpful how jupyter has cell-specific undo/redo. Across cells sounds fine, but ideally we would keep within cell granularity on edits. Tracked in https://github.com/fonsp/Pluto.jl/projects/2#card-39978916.
suggested higher-priority keymaps from VScode
VScode has hundreds of default keybindings, so IMHO still worth suggesting which ones to prioritize. Although maybe better to prioritize integration with VScode. Just user suggestions from my armchair over here, seems like you all already have great intuition of what is most impactful to work on :).
-
ctrl-d/ctrl-k: in Atom (or VScode with Atom bindings), this allows one to create another cursor with next selection matching current cursor. ctrl-k skips selection for the next occurrence. This is my most used shortcut, and would love to have!
-
alt-up/down: suggest this swaps a line up/down
-
alt-shift-up/down: suggest this create new cursor above/below
-
ctrl-shift-D: suggest this duplicates line
-
ctrl-P: fuzzy file selector is awesome.
-
ctrl-shift-P: fuzzy command selector + keyboard shortcut lookup is awesome (but maybe better to just integrate with VScode)
@tbenst I've moved some of my comments to the first post to make them harder to miss - https://github.com/fonsp/Pluto.jl/issues/65#issue-595782206. Could you consider editing your comment?
thx for the comment. revised! I hope it's more helpful now
Thanks. About page up and page down - I appreciate your concern, but have you tried it out? It still works for scrolling the page, but when the focus is inside a cell editor, it switches between cells.
I like that you mention preserving the original action of that key, I also think that this is important. Normally (on the web), when you focus on a textbox (like the one i am typing in), page up/down are limited to within that box, and don't scroll the page. Because Pluto cells are often quite small, this function is of little use, so I thought that it is fine to hijack these keys and assign them to something more useful. The new behavior of the page keys is actually closer to the static page semantic: you use it to scroll up and down the page in jumps.
Oh I didn't realize that! I had thought that since there was no modal editing that shortcuts would always act the same way. Some visual accent might be nice (eg how jupyter turns edited cell blue) might be nice UX to highlight that key may act differently but don't want to diverge from this Issue too much. The current pgup/pgdow behavior makes sense in that case.
For keyboard-only use, it would be nice if, when deleting a cell, the focus automatically shifted to the next/previous cell, so you didn't have to click it.
No delete key on Mac; shift-backspace doesn't work to delete a cell.
What does ''
mean in the table for adding a cell?
I also don't have PgUp and PgDown and don't seem to be able to move between cells without clicking?
What about a shortcut for showing / hiding the cell's input block?
-
Cmd + /
for commenting all lines in a cell. (I think this is standard in CodeMirror?) -
Keyboard shortcuts for moving between slides in presentation mode.
we can also work on implementing an optional vim mode.
just want to say Jupyter after so many years never have tier 1 support Vim-like key binding, this is a huge deal for people who forgot how to use mouse.
We probably don't need full vim experience, as long as the movement and basic remap (map esc
to kj
in input mode for example) would suffice.
Backspace or Delete | Delete empty cell (delete code manually first)
This is counter intuitive to me. I always delete more than I expected.
What about using "Shift+Backspace" to delete a cell?
This is counter intuitive to me. I always delete more than I expected.
What about using "Shift+Backspace" to delete a cell?
Agreed on this - several times now I have held Backspace down (Mac) and it's deleted the contents of the cell [desired behaviour] then carried on immediately deleting the contents of the cell above [not desired behaviour (for me)]. It would be nice to discretely delete the contents of a cell without having to release at the correct millisecond before the cursor rampages backwards into the cell above, all from the keyboard.
I would also really want an "all keyboard" Pluto.jl experience. My preference goes to vim or Spacemacs like key bindings/ shortcuts. I believe the Spacemacs
https://github.com/fonsp/Pluto.jl/issues/65#issuecomment-674879675
I don't think it's been suggested before, but what about a shortcut to split a cell at point ?
A keyboard short-cut to toggle the editor.css.main.max-width variable to device-width. I find this particularly useful when visualizing large datasets on a large monitor.
A keyboard short-cut to toggle the editor.css.main.max-width variable to device-width. I find this particularly useful when visualizing large datasets on a large monitor.
FWIW, Adding the following code to a cell at the bottom does the job (without a kb shortcut)
HTML("<style> main { max-width:1000px; } </style> ")
I love many things about Pluto, but I have to admit that I'm really not enjoying the shortcuts. Being a keyboard fanatic (and a modal editing lover), I get frustrated quite rapidly, in particular for the inability to switch to a dual mode editing (something like Vim or even a simpler one like Jupyter). Would it be too hard to let the user choose between the two? Or giving the user the ability to set her own shortcuts, being them modal or not? (Maybe it's already possibile and I missed it, and in that case I apologize)
Not sure if the right place to mention this but the FAQ* claims Ctrl+Shift+Delete
deletes a cell but (at least for me on a Mac) it does nothing.
- side note: emoji in URLs? Kids these days... π
edit from @fonsp: thanks!
Not strictly a keyboard shortcut, but: I stumbled onto the fact that Option+drag does column selection mode which is awesome but I can't find documented anywhere.
EDIT: In fact, it looks like multiple cursors in general are supported, just Cmd+click to add another cursor or Cmd+double click to add a word.
I don't see Cmd+]
and Cmd+[
for indent and dedent on the list.
On macOS, the Cmd-Q and Cmd-P shortcuts can't be triggered because they're intercepted by the browser (to quit the application / print webpage respectively). I don't have an good suggestion for an alternative at the moment β Ctrl-C for interrupting execution would be nice, but not compatible with Windows. Perhaps Ctrl/Cmd-0? (Jupyter's shortcut is 0,0 in Normal mode)
I would also like the Up / Down arrows to navigate between adjacent cells when they go up against cell boundaries (this is supported by Jupyter).
Another point in favour of an explicit Shift-Backspace for deleting a cell instead of Backspace on an empty cell - the undo history of a cell is lost after being deleted and restored, meaning that holding down Backspace for too long could leave you with no way of recovering the deleted text.
Another welcome UX improvement: selecting text and typing an opening delimiter ([{"
should enclose the selected text in the respective pair instead of replacing it.
This is really useful for eg. wrapping a function around some existing expression, and supported by most editors I know (VS Code, Atom, Jupyter, etc.)
If this is supported, it would be natural for the TBD actions "Wrap in begin ... end" and "Wrap in let ... end" to be implemented as simply b
and l
with a selected region.
@fonsp Is the issue description above documentation of all key shortcuts or there is a seperate space for it?
One approach to avoiding modal editing is a common modifier key to change an action between text and cell scope; for example:
-
Cmd+z
β undo text action -
Cmd+Alt+z
βΒ undo cell deletion
Key suggestion: run, hide and open new cell
Ctrl+Shift+Enter
I came up with this when writing a notebook with several one-line cells with markdown and assignments. It makes good sense to me when doing a lot of writing in a notebook.
VS Code keybindings for folding are Ctrl + Shift + [
for fold, Ctrl + Shift + ]
for unfold. I think this makes sense to use for hiding/unhiding. But the one I suggest above would still be a good addition, replacing the sequence Shift + Enter, Ctrl + Shift + [, Ctrl + Enter
.
Reference VS Code keybindings: https://code.visualstudio.com/docs/getstarted/keybindings#_default-keyboard-shortcuts
It would be great if some of these shortcuts for actions used frequently are implemented. As a person using jupyter notebooks a lot, where I don't need to use the mouse at all, I am not able to switch to Pluto (even though I want to) as productivity is reduced due to this not being present and have to use the mouse for common actions.
Some actions which are included in the list above which I think are most required:
- Add cell without running
- Fold/unfold cell
- Cut, copy & paste cell(s)
Also a shortcut for indenting/dedenting would be nice (Also mentioned in a comment above).
I am willing to work on this, but am not familiar with javascript. Still could try out if some idea on what needs to be done are provided. Thanks.
So what's the statement about the support for modality? Are now PRs allowed? @fonsp π
markdown for empty cell:
It would be great to have ctrl+m
on the list (since it works), and in the shift+ctrl+?
list in Pluto
While we're wishing, a keyboard shortcut to toggle the state of Live docs would be nice
While we're wishing, a keyboard shortcut to toggle the state of Live docs would be nice
+100 for Keyboard-only use of Pluto.
But instead of posting my personal favourite keyboard combinations I really think that apart from figuring out reasonable defaults, it is much more important to be able to customise keyboard combinations (#56). People very much have different preferences and find different things "natural", often depending on their favourite IDE, their OS, and whatnot. Pluto is not going to change this and good defaults only take you so far.
(BTW, I'm on Mac and disagree with the general statement that "on a Mac, it's preferred to use CTRL shortcuts for nested apps". I use CMD+... in Jupyter all the time for in-cell operations like drop the line etc. Things like CMD+Q are a problem, obviously, but CMD+D or CMD+K etc. are not.)
I fully agree with customisations and I think this also holds for modal editing, which of course cannot be solved by just allowing full customisation but requires a mode toggle which totally changes the behaviour.
Regarding the CTRL-thing under macOS, at least this is what I observed and I occasionally have clashes with keyboard shortcuts which are defined e.g. globally (mostly involving CMD). Anyways, I use modal editing wherever I can (also in Jupyter) so I cannot tell how well these things work. I had problem several years ago but never switched back when modality was introduced π
Would it be possible to add the following shortcuts?
a) split a cell at point (Ctrl-Shift + "-" in Jupyter) b) add a cell before current cell (A in Jupyter) c) add a cell before current cell (B in Jupyter) d) delete a non-empty cell (DD in Jupyter)
b), c) and d) would require "modal editing" which is not accepted even if it's from a PR, at least this is the last comment about it (from a year ago) from the main author: https://github.com/fonsp/Pluto.jl/issues/65#issuecomment-674879675
Hi! Pluto is awesome, 100% agree with @crstnbr, keybinding modification is very important, I have about 30 I use in VS Code with Jupyter and it increases my productivity dramatically, things like splitting cells and merging are all on custom keybinds. A json style keybind preference that I can version control would be amazing. Note that I can do this by modifying keybinds with something like Tridactyl which I might explore, can't make the switch to a non modal environment unfortunately.
I love Pluto, but I feel like a limb is missing when I don't have vim keybindings. I don't think this sentiment is uncommon. I feel like there is a way to use neovim backend (like with nvim plugin in VSCode), but allows you to move seamlessly between cells (pressing j on the bottom of cell 1 should move you to top of cell 2). Nobody uses enter and shift enter in normal mode, so you could keep those bindings, too. If you wanted to, you could go the spacemacs route and add a whole load of bindings with leader key (space) there, too.
Is there a toggle for "begin end" in multiline cells?
I'd suggest a shortcut to toggle Show/hide code
Can we wrap a highlighted text in quotes?
Using Safari on MacOS (Monterey) the combination Cmd+/ (for comment/uncomment) cell has no effect at all.
Alt + Up
and Alt + Down
does not work in both of my Chrome and Firefox browsers. Is it just me?
Alt + Up
andAlt + Down
does not work in both of my Chrome and Firefox browsers. Is it just me?
Same problem here on macOS/Safari. Outside a cell Option+Up and Option+Down has no effect at all. Inside a cell it moves the current line up or down.
I second LinusSch.
I'd like to automatically hide my markdown cell when I hit ctrl + enter
(I don't know whether that's appropriate for shift+ enter
).
And in case I make a mistake, either an "unhide" shortcut or Page+Up
will allow me to edit that cell.
Also - can someone with a Mac keyboard explain when shortcuts should use Command and when they should use Control? Should any existing shortcuts be different?
Cmd+Q closes the browser instead of interrupting the notebook. Maybe it should be Ctrl+Q.
I know that it's something that has been said above but it happens to me from time to time. I want to stop the notebook and instead I close the browser.
EDIT: Is there a way to cut only a selected text? the only way I found to do it is using right-click mouse and select Cut, then Ctrl+V to paste. So far Ctrl+C copy the whole line while Ctrl+X cuts the whole line. With Ctrl+V pastes the whole line too. But I mean only the selected part of a line and not the whole line.
Hi @pablosaa, sorry, what are you trying to do exactly? Ctrl+C looks to copy the selected text in the cell, while Ctrl+X cuts, on my end at least
Hi, not sure if it conflicts with your general policy regarding shortcuts but as an R user I would really appreciate a shortcut for the pipe operator (e.g. ctrl + shift + m as in R)
Which keys? Action Shift+Enter
Run cell Ctrl+Enter
Run cellΒ if the code changedΒ and add a new cell below
Hi, I'm a bit confused, why do these two default shortcuts are designed to behave in the opposite way as in jupyter notebook
?
In jupyter notebook
, usually we use Shift + Enter
to run the current cell and select below, and Ctrl + Enter
to run the current cell.
I'd suggest a short-cuts to hide or unhide code for all Markdown cells. That would be useful when proofreading notebooks.
For concreteness, I'll suggest Ctrl+Shift+M
. But I'd be happy with any choice.
Is there a shortcut for adding a cell above or below a given cell?