I'm editing an XML file with the Eclipse IDE and need to input paragraphs of text. It doesn't seem that eclipse has a line-wrap feature though. Anyone knows if it does or if there's a plugin for that?
-
3Do you want soft or hard wrap? – Ciro Santilli OurBigBook.com Jan 16 '15 at 10:09
-
Strangely, Sharad Jaiswal asked this question with exactly the same words nine years later on the Eclipse Community Forums: https://www.eclipse.org/forums/index.php/t/1098188/? – Brian Schack Jul 29 '22 at 12:41
12 Answers
Update 2016
As mentioned by ralfstx's answer, Eclipse 4.6 M4 Neon (or more) has a word-wrap feature!
(Nov 2015, for release mid 2016). In any editor view, type:
Alt+Shift+Y
(Sadik confirms in the comments it works with Eclipse 2019-09)
By default, text editors are opened with word wrap disabled.
This can be changed with the Enable word wrap when opening an editor option on theGeneral > Editors > Text Editors
preference page.
Manually toggle word wrap by clicking in the editor window and pressing (Shift+Alt+Y).
On Mac OS X, press (Cmd-Opt-Y). [Updated May 2017]
The famous bug 35779 is finally closed by r/#/c/61972/ last November.
There are however a few new bugs:
- 481873 "No line ruler number repaint on text editing with disabled "quick diff""
- 484142: "Word Wrap makes some actions very slow"
- 488162: "[word wrap] Hide WW preference to avoid unexpected performance impact"
As long as we are unable to provide acceptable editor performance for big files after toggling editor word wrap state on, we should make sure users can't set WW preference 1 always on by default and wonder why the editors are slow during resizing/zooming.
(2020) MarcGuay adds in the comments:
If you want the wrapping to be persistent/automatic, the cdhq plugin seems to still work with the 2019-03 version of Eclipse.
After installing you can turn it on viaWindow->Preferences->Word Wrap
.
Update 2014
The de.cdhq.eclipse.wordwrap Word-Wrap Eclipse plug-in just got updated, and does provide good wrapping, as illustrated in the project page:
Original answer May 2010
Try the Eclipse Word-Wrap Plug-In here.
Just for the record, while Eclipse Colorer might bring wrapping for xml files, Eclipse has not in general a soft wrapping feature for Text editor.
Soft and hard. Soft will just warp the text at the right window border without adding new line numbers (so there are gaps in the list of numbers when you enable them).
This is one of the most upvoted bugs in Eclipse history: bug 35779 (9 years and counting, 200+ votes)
Update February 2013:
That bug references an old Word wrap plugin, but Oak mentions in his answer (upvoted) a new plugin for recent (Juno+) versions of Eclipse (so 3.8.x, 4.x, may have been seen working with 3.7)
That plugin is from Florian Weßling, who just updated it (March 2013)
Right click in an opened file and select "Toggle Word Wrap" (shortcut ctrl+alt+e)

- 1,262,500
- 529
- 4,410
- 5,250
-
"Eclipse Word-Wrap Plug-In" works well in latest Eclispe PDT, thanks ! – Fedir RYKHTIK Apr 03 '13 at 09:02
-
Thanks! The Word-Wrap plugin and the line number fix work for normal txt files including .java files. But they do not work for .xml files. :( – Vince Yuan Jul 13 '13 at 15:06
-
-
1+ 1 for mentioning the soft wrap feature request. Let's upvote that to the heavens. – Ciro Santilli OurBigBook.com Jan 16 '15 at 10:16
-
To install this plug-in on Mars the Luna update site must be used: http://dev.cdhq.de/eclipse/updatesite/luna/ – Luís de Sousa Sep 10 '15 at 08:43
-
1I can't find the preference at `General > Editors > Text Editors` in Neon 4.6.0. – andraaspar Jun 22 '16 at 15:21
-
So can we make eclipse to automatically put newline charachter (not just visually wrap around) and force us typing on next line after a particular character column (say after 200 characters) in a line is reached (so that their is no more than 200 characters in any line)? Can we do this in text (`.txt`) file opened in eclipse? – Mahesha999 Aug 10 '16 at 06:42
-
1@andraaspar yes, that preference was removed. I have updated the answer to reflect that. – VonC Aug 10 '16 at 07:15
-
@Mahesha999 No, this answer is about soft wrapping, not hard wrapping (which is a setting more dependent on the language, as illustrated in http://stackoverflow.com/a/9242104/6309) – VonC Aug 10 '16 at 07:15
-
I was just needing it in plain `.txt` files, not in any specify programming language...so just was guessing if any simple solution is there... – Mahesha999 Aug 10 '16 at 07:27
-
Could you mention which of these plugins also work with comparison window (see [bug#477956](https://bugs.eclipse.org/bugs/show_bug.cgi?id=477956))? – dma_k Oct 09 '17 at 09:22
-
@dma_k I don't know: the official word wrap should be the one working, but it is not the case. – VonC Oct 09 '17 at 09:32
-
I've just tried [de.cdhq.eclipse.wordwrap](http://dev.cdhq.de/eclipse/word-wrap/) plugin and unfortunately it does not affect comparison view. Provided that for build-in editors this feature is already implemented in Eclipse Neon (4.6), this plugin has no added value. – dma_k Oct 09 '17 at 14:24
-
You don't need to install a plugin anymore to get this feature. Just try `Alt + Shift + Y`, it works (Tried in Eclipse 2019-09). – Sadık Nov 05 '19 at 08:01
-
-
@VonC Interesting. Because the link to NEON is highlighted, my eye just told me "not relevant, skip that". – Sadık Nov 05 '19 at 08:54
-
@Sadik Good point. I have edited the answer to make more apparent that *future* versions of Eclipse have that feature as well. And I have included your comment for more visibility. – VonC Nov 05 '19 at 08:59
-
If you want the wrapping to be persistent/automatic, the cdhq plugin seems to still work with the 2019-03 version of Eclipse. After installing you can turn it on via Window->Preferences->Word Wrap. – MarcGuay Jan 24 '20 at 15:40
-
@MarcGuay Thank you. I have included your comment in the answer for more visibility. – VonC Jan 24 '20 at 16:14
As mentioned in the post by VonC on this same page. Eclipse now has this capability as of 06/2016 Neon.
Try this plugin Eclipse platform plugin
It looks like eclipse only has the ability to do it manually on its own and here are the commands. At that point you must reformat the highlighted text manually.
It's not terribly obvious how to control Eclipse line width and line wrapping in your Java source files. Here's how and where:
Comment width and line wrapping is set in Preferences->Java->Code Style->Formatter
, then click on the Edit button and select the Comments tab. I like Line Width for Comments to be 120.
Code line wrapping is set nearby, in Preferences->Java->Code Style- >Formatter
, then click on the Edit button and select the Line Wrapping tab. I like a line width of 120 and indent size of 4.
Indentation is set separately, in Preferences->Java->Code Style- >Formatter
, then click on the Edit button and select the Indentation tab. I like an indent size of 4, consistent with the Line Wrapping indent setting.
As if that's not enough, you can also set printer margins, tab size, etc, in Preferences>General>Editors>Text Editors
where I set the Displayed Tab Width to 4 and Print Margin Column to 120 or more.
You can also check the Show Print Margin box to get a faint vertical line at the printer margin column

- 24,113
- 5
- 60
- 79
-
2I thought that first too, but I guessed that he's more asking for automatic wrapping while editing. – BalusC May 17 '10 at 00:17
-
-
2it took me 45 minutes of searching to figure out that comments have their own 'width' property ... does MS write this program? – cmcginty Nov 02 '10 at 02:59
-
installed this to see if it would recognise markdown files and allow me to word wrap but it doesn't recognise it as one of the 200+ it says it recognises and it doesn't seem to have an easy way to word wrap what it does not recognise and there is nothing much on google about how to get it to work. i have uninstall it. – simbo1905 Jan 05 '14 at 11:44
-
There is one limitation: this plugin doesn't work in the "Compare" view. Long lines with diff are still painful in eclipse. – haddr May 07 '16 at 18:11
-
So can we make eclipse to automatically put newline charachter (not just visually wrap around) and force us typing on next line after a particular character column (say after 200 characters) in a line is reached (so that their is no more than 200 characters in any line)? Can we do this in text (`.txt`) file opened in eclipse? – Mahesha999 Aug 10 '16 at 06:42
Ctrl+Shift+F will format a file in Eclipse, breaking long lines into multiple lines and nicely word-wrapping comments. You can also highlight just a section of text and format that.
I realize this is not an automatic soft/hard word wrap like the other answers, but I don't think the question was asking for anything fancy.

- 8,719
- 5
- 40
- 68

- 5,913
- 5
- 50
- 66
-
2it will word-wrap assuming your current editor supports word-wrapping. For instance, pydev does not currently (circa jan 2014). – ecoe Jan 14 '14 at 00:04
-
-
Ugh.. **hard wrap**. PS: regarding "anything fancy" I infer from the question's "need to input paragraphs of text" that he doesn't want to press Enter at the end of each line. So I conclude he is looking for *soft wrap*. Plus, he asked if there's a plugin. – ADTC May 26 '16 at 10:28
Eclipse Neon (4.6), release date June 2016, includes word wrap for text editors. It's disabled by default, and can be activated and deactivated using the key shortcut Alt+Shift+Y
(on Mac OS, Cmd-Opt-Y
). Some editors also supply a tool bar button for activating word wrap.
See the 4.6 M4 New and Noteworthy

- 10,960
- 3
- 45
- 74

- 3,893
- 2
- 25
- 41
-
-
2I could not enable this in Mac. Alternative keyboard shortcuts (option or command) did not activate it, and it is not available in Help or any other menu. – Deborah Dec 08 '16 at 00:11
-
1
-
The Eclipse Word-Wrap plugin works for any type of file for me.

- 7,022
- 3
- 30
- 30
-
1
-
Ive installed your Word Wrap plugin, restarted eclipse but can't figure out the option for Word Wrap. Am I missin something? I'm Using Eclipse Juno, and installed PHP PDT on Juno. Switched to both perspective PHP/Jave EE , but can't seem the option to word wrap even after installing Word Wrap plugin. Can you help me please? Thank you in advance. – Sanjay Apr 22 '13 at 02:06
-
2Once installed you have you right-click anywhere in the editor and select `Toggle Word Wrap`, OR press Ctrl-Alt-E. – gbmhunter Dec 10 '13 at 02:46
Ahti Kitsik's plugin is mentioned above, but there's a newer plugin by another author that works with newer versions of Eclipse (up to Juno, at least), and also fixed the line numbering issue in the older plugin.
Full installation instructions are at Eclipse version to download the word wrap plug-in

- 6,579
- 7
- 67
- 92

- 26,231
- 8
- 93
- 152
From Bug 35779 - Comment 187:
A workaround, that I use for the last years now, is to use the eclipse wiki markup editor for editing text files. This supports word wrap, and this is enough for me. Maybe this information could be of help to some of you.

- 700
- 8
- 18
In Version: 2019-12 (4.14.0) on MAC
Go to Windows
-> Editor
-> Toggle Word Wrap

- 1,426
- 3
- 27
- 60
-
1Under Win 10 Alt+shift + Y do the trick, or there is a small icon menu with toggle word wrap, toggle block selection, show white space chars. Here you can select the first. I use version 2020-09 of IDE. – Csaba Tenkes Nov 16 '20 at 11:05
Word wrap comes out of the box with Juno now. Right Click on the editor and select the "Word Wrap" option from the dropdown.

- 35,521
- 22
- 122
- 171

- 366
- 4
- 11
-
2@africanherbsman Cannot find the "Word Wrap" option either. Is it specified in a special perspective or in any kind of perspective? I am in the C++ one. – Wang Feb 15 '13 at 16:18
-
1I'm on Default Eclipse Juno Java EE Version, but can't figure out option for WOrd Wrap. – Sanjay Apr 22 '13 at 02:09
First alpha of eclipse word wrap released!
Got this answer from this post: How can I get word wrap to work in Eclipse PDT for PHP files?

- 1
- 1

- 1,264
- 9
- 17
In Eclipse v4.7 (Oxygen):
Window menu → Editor → Toggle Word Wrap (Shift+Alt+Y)

- 6,289
- 4
- 36
- 51
Try AhtiK Eclipse WordWrap, it works for me: http://www.ahtik.com/eclipse-update/

- 733
- 8
- 18