Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij comment shortcut opens help tab on the Mac menu bar

When I use the Cmd + Shift + / keyboard shortcut to comment/uncomment a block of code, the Help tab on the menu bar in IntelliJ also opens.

Does anyone know how to prevent this shortcut from opening the Help menu tab in IntelliJ 16.1.2? I am using the Mac OS X 10.5+ shortcuts.

like image 521
PhillyStafford Avatar asked Jul 01 '16 11:07

PhillyStafford


People also ask

How do I comment in IntelliJ Mac?

To quickly add a line comment in IntelliJ IDEA, press ⌘ / on macOS or Ctrl + / on Windows and Linux. Block comments or multi-line comments usually take the form of a paragraph. There are exceptions like when we need to insert a comment in the middle of the code line.

How do I toggle comments in IntelliJ?

Comment and uncomment blocks of code From the main menu, select Code | Comment with Block Comment. Press Ctrl+Shift+/ .

How do I change the shortcut key in IntelliJ?

Configure keyboard shortcuts IntelliJ IDEA includes several predefined keymaps and lets you customize frequently used shortcuts. To view the keymap configuration, open the Settings/Preferences dialog Ctrl+Alt+S and select Keymap. IntelliJ IDEA automatically suggests a predefined keymap based on your environment.


4 Answers

Remove or replace the Cmd + Shift + / shortcut in your mac. Apple menu-> System Preferences-> Keyboard -> Shortcuts.

ss

like image 97
Bajal Avatar answered Oct 22 '22 14:10

Bajal


Steps:

  1. Remove or replace the Cmd + Shift + / shortcut on your Mac (as mentioned by @Bajal)
  2. Add new Intellij shortcut Cmd + 7 for "Comment with Line Comment" (Preferences -> Keymap)

enter image description here

like image 44
Peter Keller Avatar answered Oct 22 '22 15:10

Peter Keller


I used this work around but it didn't fix the problem:

In IntelliJ, I went to Preferences -> Keymap and I searched for comment. It turns out that there are 3 different commands to comment/uncomment a block of code.

  1. Cmd + Shift + /
  2. Ctrl + Shift + /
  3. Cmd + Alt + /

My work around to prevent Cmd + Shift + / from opening the Help menu tab is to use one of the other keyboard shortcuts.

This doesn't answer my question fully so if anyone has any suggestion please let me know as I would prefer to use Cmd + Shift + /

like image 25
PhillyStafford Avatar answered Oct 22 '22 14:10

PhillyStafford


I had the very same issue. The solution by Bajal helped, because the shortcut didn't trigger the help tab. But it didn't allow me to line comment my code.

So I had to add Shift + Cmd + 7 to the keymap. This is exactly the same as Cmd + /, but I had to add it anyway.

like image 23
Julian Avatar answered Oct 22 '22 14:10

Julian