How to split a code cell in Google Colab?

Solution 1:

I don't know how to do it via menu selections, but in Jupyter Lab the shortcut is "Ctrl+Shift+-" to split a cell. Google Colab's shortcuts often replace "Ctrl+Shift+…" with "⌘/Ctrl+M …".

So, in this case, it would probably be "⌘/Ctrl+M -".

The "Keyboard shortcuts" window confirms this.

Solution 2:

If you go to:

google colab page menu -> Tools -> Keyboard shortcuts -> Split at Cursor

you can find it.

The default is Ctrl + M -, But you can modify it to whatever shortcut you prefer.