In Google Colab, is it possible to expand/collapse all section toggles using a shortcut?

Viewed 950

I'm using Gooogle Colab to keep a record of code I learn whilst working through the 'Google IT Automation with Python' course.

I use the table of content feature to group sections of code by topic. These sections can be toggled in the main window to show or hide their content.

However, with so much code building up, I would like a way to quickly close all toggles e.g. as shown in the picture.

(Alternatively, if anyone has a better method or can recommend a better platform for building, testing and organising code snippets in a way that is easily retrievable, I'd welcome the recommendation).

Thanks!

enter image description here

2 Answers
  • Ctrl + ] invokes "Collapse all/select sections" in command mode (not editing a cell).

  • Ctrl + [ after hitting Ctrl + ] expanded all cells in my experiment, but this is not documented.

Please note that, in edit mode (when you have a blinking cursor), Ctrl + ] and Ctrl + [ means "indent" and "dedent" respectively1.

You can find a list of all available commands at "Tools" menu -> "Command palette" (go ahead and have a glance; it's worth it!).


1 source: https://gist.github.com/discdiver/9e00618756d120a8c9fa344ac1c375ac#shortcuts-when-in-edit-mode-inside-a-cell-with-a-blinking-cursor

If Ctrl + ] or Ctrl + ] with keyboard shouldn't be work you can find a voice that invokes "Collapse/Expand sections" in View->Collapse/Expand sections.

Related