Comment/uncomment a block of code in NetBeans shortcut

Viewed 97977

Is there a shortcut in NetBeans to highlight a block of code and comment/uncomment it?

5 Answers

The list of keyboard shortcuts can be found in the NetBeans Wiki.

Turn On/Off Search Result highlights

Alt + Shift + H

Add/remove comment. Should work for all languages

Ctrl + / or in mac ⌘ + /

Also, to have a whole block commented, can be useful the rectangular selection trick as a single "null column" rectangle where we can add any comment character we like (eg. an hash or a slash):

enter image description here

The shortcut in Mac is Ctrl+Shift+R as explained in this thread.

To return to the normal selection just repeat the same shortcut.

Related