Commenting blocks in Eclipse on Mac
27,288
Solution 1
Command (the clover/apple key next to the space bar) forward slash (/)
Solution 2
Apple + Shift + / will toggle a block of selected code using /* */
Apple + / will toggle a line (or multiple, if selected) using //
You may have to disable the OS hotkey (apple + shift + / brings up the help menu)
Solution 3
Ctrl + cmd + / <- block comment and Ctrol + cmd + \ <- remove comment
Solution 4
Command
+ /
comments the selection.
Author by
burntsugar
Trainer. Student. Developer. Java, Android, Sushi, CAPSLOCK. Concentrates really hard. Especias Secreto. Melbourne Australia.
Updated on January 14, 2022Comments
-
burntsugar over 2 years
How do I comment blocks of code in Eclipse on a Mac?
-
user1182253 about 11 yearsHow to disable the OS hotkey in Mac ?
-
Firas almost 11 years@user1182253 Goto your Mac Settings application -> Keyboard -> Shortcuts/Hot Keys -> Applications shorcuts -> disable "show help menu" Sorry if there are some mistakes in the menu labels, my mac os is not in english.
-
Marcus over 9 yearsUnfortunately, even with this, it won't work for xml code comments/uncomments.
-
Pahnev over 9 yearsThank you! Just started using Android studio and I use
Cmd
+Shift
+/
in every other editor for comments, but this was just bringing up the help menu. -
briggsm over 9 years@Marcus, I believe you cannot use /* */ style comments for XML. You should use <!-- --> style instead.
-
Marcus over 9 years@briggsm Right, my only point is that there aren't shortcuts for commenting blocks in xml.
-
NissimL almost 9 yearsFor me on Yosemite, on STS 3.6.4, the keys for block comments are
Cmd
+Ctrl
+/
-
Theodore Murdock about 8 yearsIt appears this has been changed to avoid conflict with the help shortcut in OSX, and the answer is now, as @PawelPros noted below, ctrl+command+/ to comment, ctrl+command+\ to uncomment.