Java Reference
In-Depth Information
combination with any of the navigation and movement keys described in the pre-
vious section to drag out a selection along with the cursor. For example,
Ctrl+Shift+Page Down selects everything from the cursor position to the bot-
tom of the screen. From the main menu, you can also select Edit | Select All
( Ctrl+A ) to select the entire contents of the file.
To select an entire line, click in the gutter area next to the line, or triple-
click the line itself. You can also drag your mouse over the gutter to se-
lect a block of lines.
TIP
By far the most useful selection tool is listed only in the Keymap settings, not in
any of the menus. It's the modestly named Select word at caret command
( Ctrl+W ). Although pressing Ctrl+W does select the current word, this com-
mand is much more powerful than its name suggests.
With each successive press, the selection grows to include the selection's next
level of containing code. For example, if you place your cursor inside the expres-
sion of a conditional block, successive Ctrl+W presses expand the selection from
a single word, to the contents of the expression of which it's a part, to its entire
conditional block, to its containing method body, to the method itself, to its con-
taining class, and so on.
If you already have a selection, pressing Ctrl+W expands the selection to
include the entire logical block of code. For this reason, we prefer to think of this
feature as “expand selection to include containing block” rather than selecting
the current word. The command Unselect word at caret ( Ctrl+Shift+W ) works
the same way, only in reverse: Each successive press shrinks the selection a level.
If you've enabled the CamelHumps option in the editor settings, the selection
grows and shrinks on logical word boundaries.
This feature is so useful, and can become so imprinted on the part of
your brain responsible for typing, that it can cause problems outside of
IDEA . On Microsoft Windows, many other applications map Ctrl+W to
mean “close the current window” (on the Mac, the command is
Cmd+W ). We can't tell you how many times while writing this book we
tried to use Ctrl+W to expand a selection inside Word or Internet Ex-
plorer—only to close the application! Worse yet, it took two months to
figure out the real cause of the “applications-keep-trying-to-close-them-
selves” virus we were convinced we'd contracted. You might want to
remap this key combination in the Keymap settings panel if you have the
same problem.
WARNING
 
 
 
 
 
Search WWH ::




Custom Search