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.

Share:
27,288
burntsugar
Author by

burntsugar

Trainer. Student. Developer. Java, Android, Sushi, CAPSLOCK. Concentrates really hard. Especias Secreto. Melbourne Australia.

Updated on January 14, 2022

Comments

  • burntsugar
    burntsugar over 2 years

    How do I comment blocks of code in Eclipse on a Mac?

  • user1182253
    user1182253 about 11 years
    How to disable the OS hotkey in Mac ?
  • Firas
    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
    Marcus over 9 years
    Unfortunately, even with this, it won't work for xml code comments/uncomments.
  • Pahnev
    Pahnev over 9 years
    Thank 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
    briggsm over 9 years
    @Marcus, I believe you cannot use /* */ style comments for XML. You should use <!-- --> style instead.
  • Marcus
    Marcus over 9 years
    @briggsm Right, my only point is that there aren't shortcuts for commenting blocks in xml.
  • NissimL
    NissimL almost 9 years
    For me on Yosemite, on STS 3.6.4, the keys for block comments are Cmd + Ctrl + /
  • Theodore Murdock
    Theodore Murdock about 8 years
    It 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.