fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.94k stars 285 forks source link

Keyboard only use #65

Open fonsp opened 4 years ago

fonsp commented 4 years ago
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.

fieldofnodes commented 2 years ago

Can we wrap a highlighted text in quotes?

roland-KA commented 2 years ago

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

GiggleLiu commented 2 years ago

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

roland-KA commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago
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 commented 2 years ago

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 commented 2 years ago

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

jedbrown commented 1 year ago

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.

lucio-cornejo commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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

PatrickHaecker commented 1 month ago

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.