NBClassic Keyboard Shortcuts: Command and Dual-Mode

by Audrey M. Roy Greenfeld | Sat, Jan 11, 2025

I'm taking inventory of all the Command Mode and dual-mode nbclassic keyboard shortcuts on macOS, with my random musings about each. This is part of my deliberate practice to master all of the useful ones, and will serve as a reference for myself later.


From Command Mode

Press Esc to get out of editing a cell (Edit Mode), then:

p: Open the Command Palette

This opens the little dialog with commands. Then you can press up or down arrows to select commands.

Change cell type:

f: Find and replace. I've never used this. I always use Cmd F and use Chrome or Firefox's search. I'm trying it. That's cool that it can take regular expressions! I tried \w+ and that was fun. To get those to work, I had to toggle the button off and then on again.

k or Up arrow: Select previous cell

j or Down arrow: Select next cell

Shift k or Shift Up arrow: Add previous cell to selection

Shift j or Shift Down arrow: Add next cell to selection

Cmd a: Select all cells. I never use this and it seems not very useful. Could I be wrong? Copy-pasting cells between notebook browser tabs doesn't work for me, and it may be related to that use case.

a / b: Insert cell above/below. I use this often.

Copy-pasting:

d then d again: Delete cell. I mostly use x instead of this, out of muscle memory not intentionality.

z: Undo cell deletion. This usually doesn't work for me because I press x. I can press Shift v when that happens, I now know.

Shift m: Merge cells. I occasionally do this by accident.

s or Ctrl s: Save and checkpoint. I use Ctrl s often. I didn't realize s does the same exact thing. That saves my pinky a bit.

l: Toggle line numbers. I rarely use this other than when Danny asks me to turn the line numbers on.

o: Toggle output of selected cells. I never use this, but I'll try it now on the time cell. Okay, I could see that being useful if a cell's output is huge, I can't truncate it, and the output iframe doesn't turn on, which happens occasionally for me.

Shift o: Toggle output scrolling of selected cells. I never use this. Maybe it'll solve my pain point of not being able to see the full version via keyboard of an iframe-truncated output. Oh, wow, I'll use this all the time now that I know about it. Wow, this would have saved me a lot of trackpad scrolling pain yesterday.

Kernel problem sequences:

Commands I don't understand, or that are broken for me, possibly due to my customizations or nbextensions:

From Both Modes

Running cells:

Cells for Testing

print(datetime.now().strftime('%I:%M:%S %p'))

Here I print the time in a test cell. That way I can see if the cell is actually run.

[i for i in range(1000)]

Here's a cell with long output, to test Shift o.