46

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..

user744959
  • 751
  • 1
  • 6
  • 13
  • There's a linked edit mode that begins when you're, say, renaming something in the file using the Refactor menu, or completing a template from Content Assist that has variables. Otherwise I'm not sure what you'd use it for. – nitind Sep 25 '12 at 13:59
  • 4
    That is kind of similar (if you mean the inline rename refactoring shift-alt-r). The difference is the one in sublime text works on any substring (which can even include spaces), and not necessarily only on complete language symbols/tokens... As for what it is useful for, try using an editor which supports it for a while and you will see how useful it can be.. – user744959 Oct 22 '12 at 12:55
  • 1
    The only solution I have got, after several times going back to the same topic, is: use ST to edit this part, save it, and Alt+Tab to Eclipse. Period. – WesternGun Jul 04 '18 at 15:47
  • FYI the bug to track this is https://bugs.eclipse.org/bugs/show_bug.cgi?id=466532 Feel free to upvote! – Pyves Sep 13 '19 at 15:53
  • With Eclipse 4.22 (Q4 2021), see also [Eclipse - multiple line editing on any substring like in Sublime Text and Atom](https://stackoverflow.com/a/70316624/6309). – VonC Dec 11 '21 at 15:55

7 Answers7

28

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

Community
  • 1
  • 1
Trevor Dixon
  • 23,216
  • 12
  • 72
  • 109
  • 2
    I would like to accept this answer, as this seems to be exactly the thing many of us are looking for, but the project seems dead for lsat six months.. – user744959 Sep 06 '13 at 14:25
  • 9
    Indeed, I let it languish for a bit but now I'm working on it again :) – Caspar May 12 '14 at 12:55
  • 4
    It's not updated anymore and the creators of it state that it was "An **aborted** attempt to provide Sublime-Text-like multi cursor support for text editors in the Eclipse IDE" – OuuGiii May 20 '19 at 06:57
9

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).

jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
2

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

andy9775
  • 372
  • 3
  • 10
1

Alt + Shift + A, then you can hold shift and use the cursor in multiple lines.

ajaysinghdav10d
  • 1,771
  • 3
  • 23
  • 33
FabianoLothor
  • 2,752
  • 4
  • 25
  • 39
0

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

mx0
  • 6,445
  • 12
  • 49
  • 54
jack
  • 1,391
  • 6
  • 21
0

ALT + SHIFT + F worked for me.

enter image description here

4b0
  • 21,981
  • 30
  • 95
  • 142
-1

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.

Blasanka
  • 21,001
  • 12
  • 102
  • 104