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

Keyboard only use #65

Open
fonsp opened this issue Apr 7, 2020 · 68 comments
Open

Keyboard only use #65

fonsp opened this issue Apr 7, 2020 · 68 comments
Labels
accessibility Accessibility improvements of the frontend, like screen reader support and internationalization frontend Concerning the HTML editor user request Requested using the feedback form inside Pluto notebooks

Comments

@fonsp
Copy link
Owner

fonsp commented Apr 7, 2020

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.

@fonsp fonsp added user request Requested using the feedback form inside Pluto notebooks accessibility Accessibility improvements of the frontend, like screen reader support and internationalization labels Apr 7, 2020
@fonsp
Copy link
Owner Author

fonsp commented Apr 8, 2020

Same shortcuts as VS Code wherever possible.

@fonsp fonsp closed this as completed Apr 8, 2020
@fonsp fonsp reopened this Apr 8, 2020
@nilshg
Copy link

nilshg commented May 12, 2020

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?

@fonsp
Copy link
Owner Author

fonsp commented May 12, 2020

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.

@nilshg
Copy link

nilshg commented May 12, 2020

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?

@fonsp
Copy link
Owner Author

fonsp commented May 12, 2020

No worries! I added the last one to the TODO list. 👍

@fonsp fonsp added the frontend Concerning the HTML editor label May 15, 2020
@fonsp fonsp closed this as completed Jun 8, 2020
@fonsp fonsp mentioned this issue Jun 12, 2020
10 tasks
@fonsp fonsp reopened this Aug 12, 2020
@nilshg
Copy link

nilshg commented Aug 14, 2020

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?)

@fonsp
Copy link
Owner Author

fonsp commented Aug 14, 2020

Added

@fonsp
Copy link
Owner Author

fonsp commented Aug 14, 2020

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?

@tamasgal
Copy link

tamasgal commented Aug 17, 2020

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 😉

Edit: oh, I just read that you don't like modal editors. 😞 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. 😉 nevertheless, I might invest time to make a PR in future if you consider to merge such a feature implemented by others?

@fonsp
Copy link
Owner Author

fonsp commented Aug 17, 2020

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.

@tbenst
Copy link

tbenst commented Aug 17, 2020

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.

  1. Based on Customise keyboard shortcuts #56 (comment) and Customise keyboard shortcuts #56 (comment) it seems like current (v0.11.6) ctrl/shift-enter does not match design.

  2. ctrl-up/down: not functional right now?

unintuitive

  1. 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?

  2. 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 :).

  1. 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!

  2. alt-up/down: suggest this swaps a line up/down

  3. alt-shift-up/down: suggest this create new cursor above/below

  4. ctrl-shift-D: suggest this duplicates line

  5. ctrl-P: fuzzy file selector is awesome.

  6. ctrl-shift-P: fuzzy command selector + keyboard shortcut lookup is awesome (but maybe better to just integrate with VScode)

@fonsp
Copy link
Owner Author

fonsp commented Aug 17, 2020

@tbenst I've moved some of my comments to the first post to make them harder to miss - #65 (comment). Could you consider editing your comment?

@tbenst
Copy link

tbenst commented Aug 17, 2020

thx for the comment. revised! I hope it's more helpful now

@fonsp
Copy link
Owner Author

fonsp commented Aug 17, 2020

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.

@tbenst
Copy link

tbenst commented Aug 18, 2020

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.

@jakobnissen
Copy link

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.

@dpsanders
Copy link

No delete key on Mac; shift-backspace doesn't work to delete a cell.

What does '' mean in the table for adding a cell?

@dpsanders
Copy link

I also don't have PgUp and PgDown and don't seem to be able to move between cells without clicking?

@dpsanders
Copy link

What about a shortcut for showing / hiding the cell's input block?

@dpsanders
Copy link

  • Cmd + / for commenting all lines in a cell. (I think this is standard in CodeMirror?)

  • Keyboard shortcuts for moving between slides in presentation mode.

@Moelf
Copy link
Contributor

Moelf commented Sep 2, 2020

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.

@david-macmahon
Copy link

While we're wishing, a keyboard shortcut to toggle the state of Live docs would be nice

@carstenbauer
Copy link

carstenbauer commented Apr 9, 2021

+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.)

@tamasgal
Copy link

tamasgal commented Apr 9, 2021

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 😆

@pgagarinov
Copy link

pgagarinov commented Apr 17, 2021

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)

@tamasgal
Copy link

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: #65 (comment)

@jackos
Copy link

jackos commented Apr 21, 2021

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.

@joshcho
Copy link

joshcho commented Jun 9, 2021

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.

@fieldofnodes
Copy link

Is there a toggle for "begin end" in multiline cells?

@RichardScharf
Copy link

I'd suggest a shortcut to toggle Show/hide code

@fieldofnodes
Copy link

Can we wrap a highlighted text in quotes?

@roland-KA
Copy link

Using Safari on MacOS (Monterey) the combination Cmd+/ (for comment/uncomment) cell has no effect at all.

@GiggleLiu
Copy link
Contributor

Alt + Up and Alt + Down does not work in both of my Chrome and Firefox browsers. Is it just me?

@roland-KA
Copy link

Alt + Up and Alt + 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.

@LAfihq
Copy link

LAfihq commented Jan 14, 2022

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.

@runjaj
Copy link

runjaj commented Jan 17, 2022

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.

@pablosaa
Copy link

pablosaa commented Feb 25, 2022

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.

@icweaver
Copy link
Contributor

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

@osmankucuksen
Copy link

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)

@efJerryYang
Copy link

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.

@eford
Copy link

eford commented Aug 17, 2022

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.

@xaviergonzalez
Copy link

Is there a shortcut for adding a cell above or below a given cell?

@jedbrown
Copy link

I use RISE with Julia for teaching and make heavy use of some bindings/features that appear to be lacking in Pluto. This comment extends beyond simply keybindings, but having so little bound was surprising when experimenting with Pluto.

  • Alt-R (enter/exit present mode). Note that RISE present mode is significantly richer than Pluto, including persistent chalkboards, fragments, and more presentation changes. This from zulip makes a Present checkbox in Pluto, but that doesn't travel with you over dozens of slides. It needs a keybinding (and lots of present-mode feature work to feel like a replacement).
  • Shift-S (split_cell). There is no equivalent to my knowledge with Pluto; the Side-by-side described here is significantly more awkward.
  • Toggle code display (rough extension called hide_code). Pluto has the display icon that does something similar, but it needs a keybinding. I think it also needs more automatic handling of markdown display/edit toggling.

@lucio-cornejo
Copy link

lucio-cornejo commented Oct 14, 2022

@jedbrown @fieldofnodes @RichardScharf
I've recently implemented many of the shortcuts that have been requested in this thread,
making it possible, for example, to split cells in Pluto, wrap Pluto cell code with
begin ... end, let ... end and other combinations.

Besides this, I've added a (very) basic tool for creating or redefining custom keyboard shortcuts.

This is a short tutorial for how to implement these features into your own Pluto notebooks.

Feedback is appreciated.

@usmcamp0811
Copy link

@lucio-cornejo awesome work! thanks!! I like the idea of having Pluto save/load the file and editing where we feel comfortable. Which got me to thinking.. If I were to do something like this and edit the notebook in Neovim where I am most comfortable, how would I go about adding a new cell?

Would be a neat thing if the Pluto API had something we could ping to tell it to create a new cell and it could either take in a line number to insert the cell OR it would just return the static cell ID so that we could paste into our file.

I dunno just a thought I had watching the video..

@lucio-cornejo
Copy link

lucio-cornejo commented Oct 15, 2022

@eford

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.

I've just added such a feature via pressing Alt+M.
However, such keyboard shortcut will trigger a visibility toggle for all markdown cells' code in the notebook.
Therefore, it's not exactly like "hide all md cells' code / show all md cells' code".

@xgdgsc
Copy link

xgdgsc commented Nov 7, 2022

Why after shift+enter focus not go to the next cell?

@PatrickHaecker
Copy link

PatrickHaecker commented Jul 31, 2024

Has anyone managed to show/hide a cell with keyboard only with a German keyboard layout?

Ctrl+K Fold/unfold cell
Does not work, as Ctrl+k obviously is already used by the browser to edit the address bar, so this keyboard event will not be delivered to Pluto. Ctrl+K (=Ctrl+Shift+k) kills the current line here.

The information from the help menu (F1)

Ctrl+Shift+[: hide cell code
Ctrl+Shift+]: show cell code
does not work, too, as [ and ] are AltGr+8 and AltGr+8, respectively, with a German keyboard layout and nothing happens when pressing Ctrl+Shift+AltGr+8 or Ctrl+Shift+AltGr+9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Accessibility improvements of the frontend, like screen reader support and internationalization frontend Concerning the HTML editor user request Requested using the feedback form inside Pluto notebooks
Projects
None yet
Development

No branches or pull requests