Wednesday, July 2, 2014

What rectangular selection can be used for in Netbeans

Netbeans has very powerfull editing capabilities.
One of the less known features is the regular selection in text files.

This is very handy, when you for example need to remove the first two columns inside a text file.

Go to the first line, press CTRL+SHIFT+R and move the cursor down to then end and left two characters.
This selects the first two character in each line.


Now with a single DEL key you can remove them all.

But there is more to this rectangular stuff...
With the rectangular selection still active, start typing hello

Here what you get...


As you see, not only deletion of text can be made via rectangular selection, but also inserting new text on multiple lines at the same time.

This is handy, when you for example wish to add a css class to a lot of <div> tags at the idention level.

A improved version of this multi row editing capability is sheduled for a upcomming version of netbeans. The corresponding enhancement request can be found here.