Intellij ctrl+w equivalent shortcut in Eclipse
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 whic开发者_如何学编程h 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?
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
in eclipse use ALT+SHIFT+→ or ← arrow
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.
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)
精彩评论