Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to toggle commenting and uncommeting code in IDEA?

Is there a way to comment/uncomment a block of selected text in IDEA?

like image 405
Blankman Avatar asked Jul 19 '10 01:07

Blankman


3 Answers

Yes, highlight the block and type Ctrl + Shift + /. To uncomment, just repeat.

like image 56
duffymo Avatar answered Oct 19 '22 23:10

duffymo


with Shift this makes for block style comments /**/, without it for line style comments Ctrl + / -> \\ (tested with IDEA 10U)

like image 20
gnat Avatar answered Oct 20 '22 00:10

gnat


Jetbrains provides a printable reference card with the default set of Windows and Mac key bindings.

For the benefit of others who might stumble across this question & answers... In addition to the windows key binding provided in other answers, there is also a keystroke for toggling a comment bock in IntelliJ IDEA on the Mac.

Line Comment

+/

Block Comment

+SHIFT+/

like image 23
Jason Braucht Avatar answered Oct 19 '22 23:10

Jason Braucht