Instantly share code, notes, and snippets.

Embed
What would you like to do?
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command

  • ⌃ : Control

  • ⌥ : Option

  • ⇧ : Shift

  • ↩ : Return

  • ␣ : Space

  • ⇥ : Tab

Command Mode (press Esc to enable)

  • ↩ : enter edit mode

  • ⇧↩ : run cell, select below

  • ⌃↩ : run cell

  • ⌥↩ : run cell, insert below

  • Y : to code

  • M : to markdown

  • R : to raw

  • 1 : to heading 1

  • 2 : to heading 2

  • 3 : to heading 3

  • 4 : to heading 4

  • 5 : to heading 5

  • 6 : to heading 6

  • ↑ : select cell above

  • K : select cell above

  • ↓ : select cell below

  • J : select cell below

  • A : insert cell above

  • B : insert cell below

  • X : cut selected cell

  • C : copy selected cell

  • ⇧V : paste cell above

  • V : paste cell below

  • Z : undo last cell deletion

  • D,D : delete selected cell

  • ⇧M : merge cell below

  • S : Save and Checkpoint

  • ⌘S : Save and Checkpoint

  • L : toggle line numbers

  • O : toggle output

  • ⇧O : toggle output scrolling

  • Esc : close pager

  • Q : close pager

  • H : show keyboard shortcut help dialog

  • I,I : interrupt kernel

  • 0,0 : restart kernel

  • ␣ : scroll down

  • ⇧␣ : scroll up

  • ⇧ : ignore

Edit Mode (press Enter to enable)

  • ⇥ : code completion or indent

  • ⇧⇥ : tooltip

  • ⌘] : indent

  • ⌘[ : dedent

  • ⌘A : select all

  • ⌘Z : undo

  • ⌘⇧Z : redo

  • ⌘Y : redo

  • ⌘↑ : go to cell start

  • ⌘↓ : go to cell end

  • ⌥← : go one word left

  • ⌥→ : go one word right

  • ⌥⌫ : delete word before

  • ⌥⌦ : delete word after

  • Esc : command mode

  • ⌃M : command mode

  • ⇧↩ : run cell, select below

  • ⌃↩ : run cell

  • ⌥↩ : run cell, insert below

  • ⌃⇧subtract : split cell

  • ⌃⇧ : split cell

  • ⌘S : Save and Checkpoint

  • ↑ : move cursor up or previous cell

  • ↓ : move cursor down or next cell

  • ⇧ : ignore

@saber47

This comment has been minimized.

saber47 commented Jun 20, 2016

Thanks! This is very helpful

@foice

This comment has been minimized.

foice commented Aug 20, 2016

is there a way to scroll the previous command or to do "ctrl-r" to reverse search my history of commands?

@lindsayad

This comment has been minimized.

lindsayad commented Sep 1, 2016

Echo that last question

@danohuiginn

This comment has been minimized.

danohuiginn commented Feb 10, 2017

It's quite confusing to show these in uppercase. The commands all need to be entered in lowercase, unless they are shown with the shift symbol above!

@daviewales

This comment has been minimized.

daviewales commented Apr 3, 2017

What does D,D mean? Do I just press d then , then d? It doesn't seem to work.

@devinbrady

This comment has been minimized.

devinbrady commented Apr 6, 2017

Echoing the question from @daviewales above... not sure how those commands are supposed to work.

@apeltzer

This comment has been minimized.

apeltzer commented Apr 13, 2017

You simply double press "D" quickly, at least that works for me ;-)

@jishnudantu

This comment has been minimized.

jishnudantu commented Jul 5, 2017

Thanks!

@lxkain

This comment has been minimized.

lxkain commented Nov 30, 2017

I woud love a keyboard shortcut for toggling (showing <-> hiding) code

@rgime

This comment has been minimized.

rgime commented Mar 15, 2018

There is a shortcut to go to the end of the line ?
I am asking this because of the autocomplete that the cursor stay behind the ) or ]
Like: i type "print(" and automatic put a ")" after the cursor bur i dont wanna type the arrows...
with the print example i need to type only one arrow, but with a lot it be cool a shortcut
Thanks.
Rafael

@kpmiller

This comment has been minimized.

kpmiller commented Mar 21, 2018

On my Mac ctrl-e goes to the end of the line, ctrl-a goes to the beginning.

@alextremes

This comment has been minimized.

alextremes commented Apr 21, 2018

How to switch from tab code completion mode to tab indent mode?

@miskaknapek

This comment has been minimized.

miskaknapek commented Jul 1, 2018

Very helpful - thanks!

@nate2s

This comment has been minimized.

nate2s commented Jul 7, 2018

On Mac + Safari, uppercase D,D did not delete, but lowercase d,d did.

@Zack-M

This comment has been minimized.

Zack-M commented Aug 11, 2018

Is there a keyboard shortcut on MacOS for opening a new notebook on Chrome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment