24
votes

In IntelliJ, if the editor cursor is in the middle of a word like this w|ord and you press Ctrl+W, it will highlight the whole word which allows you to highlight the whole word without moving the cursor to the end or the beginning of the word then do ctrl+shift+left/right arrow.

Is there an equivalent shortcut in Eclipse?

4

4 Answers

37
votes

You are looking for Alt+Shift+Up (Select Enclosing Element)

I'm using Eclipse Helios and you can change de shortcut in Window->Preferences->General->Keys

4
votes

in eclipse use ALT+SHIFT+ or arrow

3
votes

On Mac it is Ctrl+Shift+up and Ctrl+Shift+down

However, in any platform it is not nearly as clever as IntelliJ's Ctrl+W

For example, when you are inside a bracket, Ctrl+W excludes the brackets, whereas Eclipse includes the brackets, so there is no easy way to select everything within a bracket. It's the same problem with quotes.

0
votes

While previous answers cover what to look for in Eclipse, this answer is to document restoring this useful shortcut set. In Eclipse Mars, for example, I found these shortcuts initially unbound.

To (re)enable, therefore, the Ctrl+Shift+up and Ctrl+Shift+down (using Mac shortcuts by way of example), open Eclipse preferences, find the Keys section, and look for the following:

  • Select Enclosing Element (to bind Ctrl+Shift+up to)
  • Restore Last Selection (to bind Ctrl+Shift+down to)