开发者

Configure Eclipse word-boundaries so 'Next-Word-Key' skips whole identifier

If I have a piece of Code

  MyIdentifierIs开发者_Python百科Nice(OtherThingAlsoNice isBetterThen);

I'd like to change the behavior of Ctrl-Left in Eclipse from stopping here:

  My|Identifier|Is|Nice|(|Other|Thing|Also|Nice is|Better|Then|);|

to here:

  MyIdentifierIsNice(|OtherThingAlsoNice |isBetterThen);|

...or at least just not so often. Other variants would be also fine, like:

  MyIdentifierIsNice|(|OtherThingAlsoNice| isBetterThen|);|

Mainly it should stop considering a CamelCaseIdentifier to consist of several words for navigation via Next-Word, and such like.

I use SpringSourceSuite Version 2.5.1, which is Eclipse 3.6, I guess.


Try and unselect the option:

Preferences / Java / Editor / Smart caret positioning in Java names

Configure Eclipse word-boundaries so 'Next-Word-Key' skips whole identifier

And see if that enhances the user experience in term of cursor positioning.

If this is not Java, you have a similar option in:

Preferences / General / Editors / Text Editors / Smart caret positioning at line start and end

It is usually selected, meaning if the cursor still stops at every word, that may suggests another setting for a specific language is overriding it.


Coming to Eclipse from XCode, I found the default navigation annoying. In Eclipse, Alt+Left and Alt+Right move to the next camelcase segment, and Ctrl+Left/Right does nothing. In XCode, Alt+Left/Right moves between words and Ctrl+Left/Right moves between camelcase segments. This allows you to control how fine-grained your navigation is.

How I fixed this for myself was by going into Preferences > General > Keys, searching for "Word", and changing the "Next Word" and "Previous Word" bindings from Alt+Left/Right to Ctrl+Left/Right. Then the Alt-navigation is by word and the Ctrl-navigation is by camelcase segment, as in XCode.

I thought this might be useful to some.

Edit:

As I continue to use these new settings, I've found another point:

Although navigation works as advertised, selection has some funky behavior. Namely, Shift+Ctrl+Left/Right can sometimes select large blocks of text instead of just the next camelcase component.

To fix this, again go to Preferences > General > Keys, search for "Select".

Set "Select Next/Previous Word" to Shift+Ctrl+Right/Left. Unbind "Select Next/Previous Element" (there are three "Whens" to pick from, I unbound all 3).

Voila.


If you want a very simple way to select a entire word without the need to disable smart caret positioning.

You can use at the beginning of word or inside the word: Shift+Alt+Right

At the end or in the middle of word: Shift+Alt+Left

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜