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

If I have a piece of Code
MyIdentifierIsNice(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
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

Related

How to make IntelliJ IDEA display colors for different occurrences in the side bars

When coding java in Eclipse, one can easily edit the right side bar (found in settings under General\Editors\Text Editors\Annotattions) to display colors for different kind of occurrences (such as Text Occurrence, Write Occurrencies and Read Occurrencies).
In IntelliJ IDEA, there seems to be a ruler/gutter-bar on the left side and on the right side we have something called the "Error stripe bar". I seem to be able to make some static colorings, like for example setting "Constructor declaration" green. This way all Constructor declarations are highlighted green in the "Error stripe bar". I can however not find any place on how to just hilight text occurrences, write-/read occurrences, overridings etc.
In Eclipse, it is enough to just put the cursor on a variable and all write and read occurrences are displayed in the right bar (if highlighted). This way it is easy to locate the variable and not including any partial search results (such as finding for "a" would include every and each "a" in the whole text)
EDIT
Highlighting "Search Results" in the error stripe bar is the closest I have come, but is not what I want. In the case of highlighting the search results, I have to perform an extra search, CTRL + F, but this is just a dummy-text-highligter. Also, there are three options:
Search result
Search result (write access)
Text search result
None of these does the trick.
After some extended researching and testing I found a solution.
In order to get dynamical highlighting, close to what Eclipse provides in terms of "Write Occurrences"/"Read Occurrences", go to:
Settings -> Editor -> Color Scheme -> General
Under the Code section, select Identifier under caret and Identifier under caret (write)
I hope this may save some time for new IntelliJ IDEA developers coming from the Eclipse environment.

Disable line breaks after loops without body

Consider a Java while-loop without a body, for example this:
while (map.values().remove(value));
When formatting it (Shift + Alt + F), Eclipse breaks the line before the semicolon and indents it:
while (map.values().remove(value))
;
How can I configure the formatter to not add these line breaks?
Be aware that by setting this semicolon to a new line, you may avoid unintended endless loops and a long search to find them.
However, in Eclipse all code formatting properties are 1) in the project properties and 2) in the Eclipse properties. The project properties inherit from the Eclipse properties.
So if you open the project properties, type "format" in the search field. It will show you a "Formatter" menu item, that may depend on the current language (at least in Java it is called "Formatter"). Then, in this example, allow the project-specific settings, and then click edit. You will see a flood of possible details you can decide.
See here:
Then, in the tab "New Lines", uncheck the checkbox "Put empty statement on new line", in the section "Empty statements".
Often you have to try and search a bit because there are really many options. The part at right shows you a preview of the code formatting.

eclipse multiple text selection like sublime text 2

is there an option or plugin for eclipse which would enable multiple simultaneous selections in the same editor.
In sublime text, selecting some text and then pressing Ctrl+d will add next instance of the same text to the selection if possible. After selecting the instances needed the editor has multiple carrets (not necessarily on the same or adjacent columns and rows). In this mode it is possible to move all cursors forward or back simultaneously and to edit all instances of text simuntaneously.
I find this feature very usefull and miss it sorely in eclipse..
This Eclipse plugin attempts to provide this feature: https://github.com/caspark/eclipse-multicursor. From the README:
What is this?
A work-in-progress attempt to provide Sublime-Text-like
multi cursor support for text editors in the Eclipse IDE.
What works?
Multiple identical lines can be edited simultaneously using Eclipse
linked mode editing (similar to existing "rename in file"
functionality)
Next steps
"select next" functionality + associated editing using Eclipse linked
mode
"find next" + associated editing
editing of non-identical text / editing without using linked mode
split selection to lines
regexp support for find next
This feature is available in LiClipse.
See it in action (more towards the end of the video).
It supports linking with Ctrl+K, unlink with Shift+Alt+K, Ctrl+Alt+mouse double click to select words or Ctrl+Alt+Mouse to make a selection of a region (or just end lines).
Preferences>General>keys>Rename - refactoring
I changed the binding to command + shift + R when > Editing Text.
Sorry for bringing up an old question, stumbled upon it after searching google for the problem
Alt + Shift + A, then you can hold shift and use the cursor in multiple lines.
Like Ctrl+D I could not find, but like Alt+F3 in sublime (multiselects all matches), you can do by pressing Alt+Shift+R, or select text > right click > refactor > rename.
Must say that this does not work with any kind of text. It works with names of variables, functions, classes etc.
Tested on Eclipse 3.8.1
ALT + SHIFT + F worked for me.
You can see shortcuts for all here:
Goto -> Window -> Preferences -> General -> Keys and search for replace then you will see binding for Find and replace. In the bottom of that window, you can add your key to Binding text box. There you can add or edit any keys as shortcut.
If you want to replace selected word's matching words or find selected words, use below keys because you do not need to select all words in eclipse:
Ctrl+F gives me Find/Replace dialog box.
Or you can,
First Alt+A
Next Alt+F
Then press on Replace or Search button occurding to your need.

Partial AutoComplete in eclipse?

I'm very happy with the way eclipse autocompletes for me, but I was wondering if it could do something more...
I often have very similarly named variables, such as myPlayerManagerPane and myCharacterManagerPane, I was wondering if there was a way that would allow me to get half way into the name, type a character or two and then autocomplete. This would let me copy and past lines of code for both, then surgically edit the variable names. It's gotten to the point where I'm trying to do this (I'm autocompleting on autopilot) and getting fun variables such as myCharacterManagerPaneManagerPane as I autocomplete a whole name, halfway through another.
Is there a way around this?
In Window > Preferences > Java > Editor > Content Assist, select "Completion overwrites", instead of "Completion inserts". This would overwrite the entire variable with the new one.
Alternatively, you can press Ctrl to toggle this behaviour when the content assist window pops up.
Your question (or rather, its prelude) can easily be confused with another one; namely,
Say I have two variables variableLabel and variableConfiguration, how can I have Eclipse complete the common prefix of the two variables, i.e. variable, before writing either L or C and having Eclipse "AutoComplete" complete the rest?
This is the question which lead me to this thread, so I feel I must answer it:
In Window > Preferences > Java > Editor > Content Assist, check "Insert common prefixes automatically". Pressing Ctrl+Space now results in the desired functionality.
Relevant StackOverflow question

Double click text selection in CFEclipse

In CFEclipse, I do a lot of double-clicking to select text. The standard behavior is to select all text within the nearest word boundaries. This is problematic when editing code where the original editor didn't use camel-case; for example, they wrote "myObject" as "my_object".
Is there a way to change the double-click selection behavior to include '_' as a valid word character?
In the latest version of CFEclipse, there is now the option to define what characters are considered word boundaries when double-clicking, and also the option to use different characters when using alt or shift keys.
In Preferences, goto CFEclipse > Editor > Text Selection to update this:
(source: bpsite.net)
CFEclipse does not recognize either the underscore or a period as a character for selecting text with a double-click. There is no way that I know of other than rolling your sleeves up and hacking the editor code to change it. I doubt that this will be changed any time soon with the impending release of Bolt from Adobe.
On eclipse 3.4.1 Ganymede, it seems to select the nearest boundaries including the '_' (at least in the java file I am using)
What eclipse version are you using ?
This blog even reports that eclipse3.3 does select word as you are expecting it...
vs.