Hidden NetBeans Feature: Search In Editor Selection
By Geertjan on Jan 18, 2012
Probably this is obvious to many people, but when I first discovered it I was quite (pleasantly) surprised. When you select a section of code in an editor, you can search within that particular selection:
Here I selected a paragraph (which could have been anything, e.g., a block of code in the Java editor or a subset of words within a paragraph), then pressed Ctrl-F (which is "Find"), which puts my cursor in the small Find area in the bottom left of the screenshot above. Then I type "if", since that's the word I want to find and now, only within the selected text (e.g., not the "if" in the next paragraph above, since that paragraph wasn't selected), all the instances of the word "if" are found and then I can toggle forwards and backwards with F3/Shift-F3.
And all within whatever was selected when Ctrl-F was pressed. Then you can do a replace of all found items, i.e., only within a particular selection.
Tried and failed to do the same thing in IntelliJ IDEA Community Edition 10.5, while in Eclipse Indigo a Find/Replace dialog pops up with the "Scope" automatically set to "Selected Lines". So, in that respect, Eclipse appears to be better than IntelliJ IDEA, though I still prefer not having to use a dialog, which is what NetBeans supports, i.e., the Find/Search bar is integrated into the editor itself, as can be seen from the screenshot above.