I thought this would be easy to achieve, but so far I haven't found solutions for comment/uncomment shortcut on both Java class editor
and jsf faceted webapp XHTML file editor
:
- to quickly comment/uncomment a line (like ctrl + d is for removing single line)
- being able to choose multiple lines and comment/uncomment it
For example :
single line java code, from :
private String name;
into
//private String name;
multiple line java code, from :
private String name;
private int age;
into
/*private String name;
private int age;*/
single line xhtml code, from :
<h:inputText ... />
into
<!-- h:inputText ... / -->
multiple line xhtml code, from :
<h:inputTextarea
rows="xx"
cols="yy"
...
/>
into
<!-- h:inputTextarea
rows="xx"
cols="yy"
...
/ -->
For single line comment you can use Ctrl + / and for multiple line comment you can use Ctrl + Shift + / after selecting the lines you want to comment in java editor.
On Mac/OS X you can use ⌘ + / to comment out single lines or selected blocks.
Comments In Java class
Comments In HTML/XML/Config file
Ctrl + 7 to comment a selected text.