13

I had a hard time figuring the keyboard shortcut.

Is that true that I should press Ctrl-m together and press the other key such as d to delete one cell? I tried it but it did not work for me I also tried without - but it still does not work for me :(

I am using a Mac.

3 Answers 3

25

You have to first toggle the right cell state.

The newer version of IPython revamped the command structure, so that cells have two states: input mode, when the cell has a green outline, and command mode, when the cell has a grey outline.

When its green you can edit the content and run it. When its grey you can use the delete insert cell or copy commands.

Hitting Enter or Return activates the green state, while using Esc activates the grey state.

For example:

To delete a cell, use Esc to go in command mode, like the grey outlined cell below, and simply press the d key twice.

img

Sign up to request clarification or add additional context in comments.

5 Comments

great!! It works!! so it means that I don't have to use ctrl-m any more, just use esc right? Another question is besides delete, do you know any other short-cuts need double click? I can't find the description online...@agconti
yep! you dont need control-m anymore. what do you mean by double click?
I mean to press d twice...sorry for the imprecision...are there any other shortcuts which need to be pressed twice as well?
@MYjx I'm not to sure myself, but for the full list of available shortcuts, click Help, Keyboard Shortcuts in the notebook menus.
Here are my 2 cents. In jupyter version 4, when Esc is pressed, the cell now turns blue and not grey. The small edit symbol disappears from the right top corner of the notebook.
5

On my mac, I use fn key, instead of ctrl, to make shortcuts work in iPython notebook (in Safari). For example,

  • fn + d + d deletes a cell (d + d works too)
  • fn + x cuts a cell
  • fn + c copies a cell
  • fn + z undoes an action,

and so on. As already noted above, you must press Esc before applying any of these shortcuts; that is, you first hit Esc to make a cell "grey", then you press fn + x to cut a cell.

Comments

2

You first press Ctrl and m (don't press the minus key), that will put the interface in command mode. For deletion you then have to press d twice.

1 Comment

it still did not work for me no matter how many times I hit the d :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.