views:

364

answers:

2

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

+7  A: 

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.

Jon Skeet
+3  A: 

There are two possibilities:

Every line prepended with //

ctrl + / to comment  
ctrl + \ to uncomment

Complete block surrounded with block comments /*

ctrl + shift + / to comment  
ctrl + shift + \ to remove
Ikke
Ctrl-\ will only *remove* comments.
Jon Skeet
My bad, my memory let me down, fixed it now.
Ikke
+1 for being more descriptive about the differences than the other guy.
invertedSpear