Search code examples
eclipsecommentshotkeys

How to comment a block in Eclipse?


Does Eclipse have a hot key to comment a block? and to uncomment a block?


Solution

  • Ctrl-/ to toggle "//" comments and Ctrl-Shift-/ to toggle "/* */" comments. At least for Java, anyway - other tooling may have different shortcuts.

    Ctrl-\ will remove a block of either comment, but won't add comments.

    Note: As for Eclipse CDT 4.4.2, Ctrl-Shift-/ will not uncomment a "/* */" block comment. Use Ctrl-Shift-\ in that case.

    EDIT: It's Ctrl on a PC, but on a Mac the shortcuts may all be Cmd instead. I don't have a Mac myself, so can't easily check.