19

I like to use Eclipse's Java editor feature that allows the me to split the editor window into several panes so I can look at multiple files at once (See below). When I do this, the editors usually can't display the longest lines, and I have to use the horizontal scroll bar.

Multi-pane Editor Example

I don't want to reformat the source itself because the window widths change depending upon what I'm looking at. So what I'm looking for is a soft line wrap, like many editors support (See below). Can I do this in Eclipse?

Good Editor Example

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
  • 2
    A bit like http://stackoverflow.com/questions/2846002/does-eclipse-have-line-wrap/2847783#2847783 and http://stackoverflow.com/questions/3721670/in-the-eclipse-text-editor-how-can-i-reformat-fill-justify-a-paragraph-to-8/3721870#3721870 – VonC Jan 10 '12 at 16:20
  • The 2014 version of the Eclipse Word-Wrap Plug-In seems interesting. See [my answer below](http://stackoverflow.com/a/21983756/6309) – VonC Feb 24 '14 at 09:36

5 Answers5

10

Nope. Not that is hasn't been asked for.

There's a plugin but I've never used it.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • I never looked for it until now. Incidentally the issue has just been marked as fixed and is scheduled for 4.6. – musiKk Dec 17 '15 at 12:30
6

This bug has been finally fixed in Eclipse 4.6 Neon: https://www.eclipse.org/eclipse/news/4.6/platform.php#word-wrap

EDIT: Here's a screenshot of a Java editor with the feature active. Screenshot showing this in action

Blaisorblade
  • 6,438
  • 1
  • 43
  • 76
  • That appears to be only for text, not code. They only added a keyboard shortcut to an existing feature. – Jeff Axelrod Jun 24 '16 at 17:28
  • 1
    You're right it seems only for text (doh!), but I can confirm the feature did not exist previously, even though the changelog I linked is indeed ambiguous — I checked again the bug report you had linked — https://git.eclipse.org/r/#/c/33542/. That bug is not very explicit about line wrapping for code though... – Blaisorblade Jun 25 '16 at 13:59
  • 2
    I just downloaded Neon just to check, and the feature works for Java too. It seems their "text editors" include any textual code editors. Again, the changelog entry is as ambiguous as possible. – Blaisorblade Jun 25 '16 at 14:28
  • 1
    There's no button when viewing source code, but `Shift`+`Alt`+`Y` enables it for source code as well. – nilskp Jun 01 '17 at 13:51
5

February 2014: the new repo de.cdhq.eclipse.wordwrap from Florian Weßling (ColdDevil) does provide good wrapping.
It just got updated to support Auto-Wrapping on Startup:

When it's activated in the preferences word wrap will be automatically enabled in all open editors when Eclipse is started.

See the project page:

http://dev.cdhq.de/eclipse/word-wrap/img/01_wrappingOff.gifhttp://dev.cdhq.de/eclipse/word-wrap/img/02_wrappingOn_full.gif

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

It seems that this is not possible in Eclipse at this time; this feature has been requested and unimplemented since 2003 with 103 users on the CC list.

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
  • Good news: there's finally a fix in Eclipse 4.6 Neon: https://www.eclipse.org/eclipse/news/4.6/platform.php#word-wrap, and I found it from that bug report. – Blaisorblade Jun 24 '16 at 15:09
1

There is now a plugin allowing soft wrapping. It is experimental and will break the line numbering.

http://ahtik.com/blog/projects/eclipse-word-wrap/

Barth
  • 15,135
  • 20
  • 70
  • 105