1

I want to do block-comments in Colab using a Mac laptop (Big Sur), so I had a look here:

Is it possible to do block-comments in Google Colab?

Ctrl+/ does not work for me, so I follow jakevdp's advice:

If this does not work for you, check Tools->Keyboard Shortcuts and search for "Comment Current Line" to see what the shortcut is within your current settings.

Here's the output:

Enter image description here

This leads to several problems:

  1. The shortcut I need is one of the very few that can't be customized.
  2. On my non-American keyboard, I need to press Shift+7, to get /
  3. On the Mac, + Shift + 7 is bound to the Help menu: How to use the macOS Help menu

To summarize, every time I try to comment a block of code, the Help menu opens instead. Is there any workaround for this?

PS: I tried all the other answers to Is it possible to do block-comments in Google Colab?, and they didn't work.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DeltaIV
  • 4,773
  • 12
  • 39
  • 86
  • 1
    This is the subject of [a meta question](https://meta.stackoverflow.com/questions/417825/migrate-my-question-will-i-get-the-reputation-back). – Peter Mortensen May 03 '22 at 09:24
  • 2
    "non-American keyboard" What keyboard *do* you have? Why not change the keyboard layout? Note that ⌘+Shift+7 doesn't open the help menue on my Mac (it's the shortcut for "show status bar" in Safari) so does not seem to be set in stone either. – MisterMiyagi May 03 '22 at 09:25
  • 1
    It could be [a Spanish](https://arduino.stackexchange.com/questions/17057/keyboard-print-skips-keys/75525#75525) or Danish keyboard layout. – Peter Mortensen May 03 '22 at 09:33
  • FWIW, using `⌘` *changes* the meaning of some special keys. On my German keyboard, `/` is `Shift+7` but `⌘+/` is ``⌘+Shift+ß`. – MisterMiyagi May 03 '22 at 09:51
  • A few Suggs: 1- Switch Keyboard Layout - do your Shortcut - switch back... // 2- Remap one Key you don't use to `/` using some Remap Keyboard Manager/Utility... // 3- Plug in some USB US/International Keyboard... – chivracq May 03 '22 at 10:04
  • ... // 4- Use the Stack Overflow USB Keyboard '[The Key v2.0](https://meta.stackoverflow.com/q/411816/3799241) with 4 Keys and remap the programmable Key to `/`... :idea: – chivracq May 03 '22 at 10:17
  • @PeterMortensen you got it :-) – DeltaIV May 04 '22 at 14:00
  • 1
    @MisterMiyagi changing the keyboard layout just to use Colab is a no-no - it will mess up the rest of my workflow. I like my current keyboard layout :-) – DeltaIV May 04 '22 at 14:02

1 Answers1

0

I found a simple solution. If the standard solution + Shift + 7 doesn't work for you (like it didn't for me)....just use the / from the numeric keypad!

+ numeric keypad 7 worked great for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DeltaIV
  • 4,773
  • 12
  • 39
  • 86