, 16 tweets, 6 min read
My Authors
Read all threads
Jupyter Notebook Keyboard Shortcuts, new thread 👌!

We're trying to make this interactive; if you're on desktop, fork this project and follow along: notebooks.ai/rmotr-curricul…

✅ Words with *stars* are concepts.
✅ Words with [brackets] are keystrokes.

👇👇👇👇👇
First off:

A Jupyter Notebook is an interactive code environment. It supports multiple languages, but the most common one is Python 🐍. We write code in *cells*, and the execution provides immediate feedback 🏃‍♀️:
One thing that confuse beginners is that Notebooks have two different *modes* 🚦:

✍️ Edit mode: To write code.
⚡️ Command mode: run commands (this thread)

It's easy to differentiate them:
* In command mode ⚡️ the cell is greyed out
* In edit mode ✍️ the cursor is blinking
To switch modes, we'll use:

* The [ESCAPE] key to go to ⚡️ command mode
* The [RETURN] key to go to ✍️ edit mode.
⚡️ command mode is VERY important. It'll let you use *keyboard shortcuts* 🔑 to move a lot faster and be more efficient when using Notebooks.

The following tweets assume you're in ⚡️ command mode (make sure you hit that [ESCAPE] Key).

👇 Shortcuts Reference 👇
🔑 1. Navigation Shortcuts 🚀

On ⚡️ command mode, hit:

* [UP] arrow key to navigate to cells above 👆
* [DOWN] arrow key to navigate cells below 👇

(If you're a vim user, you can also navigate with [J] & [K])
🔑 2. Shortcuts to create new cells 📲

* Press [A] to create a cell "[A]bove" the current selected cell 👆

* Press [B] to create a cell "[B]elow" the current cell 👇
🔑 3. Shortcut to delete cells ☠️

Use the [UP] and [DOWN] arrow keys to move to the cell that you want to delete and hit the [D] key *2 times*. You have to chain the key presses quickly: [D] [D]
🔑 4. Shortcut to undo your previous command 🙅

Did you incorrectly delete a cell 😱? Don't worry! You can just undo that action.

✨ To undo your previous command, use the [Z] key ✨

(To remember this shortcut, think about ctrl+[Z])
🔑 5. Shortcuts to execute code 🔥

(this works on both edit ✍️ and command ⚡️ modes)

To execute code, keep the [CTRL] key pressed, and hit the [RETURN] key. The shortcut is: [CTRL + RETURN]

Extra 🍰: use [SHIFT + RETURN] to execute the cell and navigate to the cell below.
🔑 6. Copy and paste cells 🛠

On ⚡️ command mode, hit the [C] key to [C]opy a cell. Navigate to the position you want to paste it and hit the [V] key. It'll be placed below.

(remember this command because of ctrl+c & ctrl+v).
🔑 7. Shortcut to change cell type

On ⚡️ command mode:

* Hit the [M] key to switch to [M]arkdown mode 📝.
* Hit the [Y] key to go back to p[Y]thon code 🐍.
🔑 8. Shortcut to interrupt the kernel

Did you get stuck on an infinite loop 😵?

Hit the [I] key two times to [I]nterrupt the kernel. Chain the two key presses quickly: [I] [I]

(similar to the delete command we saw before).
🔑 9. Shortcut to restart the kernel 🎁

Sometimes, there's no other way than just restarting the whole kernel. Similar to Interrupt, hit the [0] (zero) key two times quickly: [0] [0] (again, that's a zero).
🔑 10. Merge multiple cells 👯‍♂️

(this is an less known feature 💎)

Select the cells that you want to merge and, while maintaining [SHIFT] pressed, hit the [M] key: [SHIFT + M]

Isn't that amazing? 🍰
Useful trick: if you ever forget any of these commands 😢, use the command palette to search for them. The keyboard shortcut will appear next to the command 😁.
Missing some Tweet in this thread? You can try to force a refresh.

Keep Current with RMOTR

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!