53

Simple question: how do you enable word-wrap by default in Eclipse? I looked at this plugin but it only goes up to Luna. In addition, this plugin is a separate text editor and does not have syntax highlighting or validation. I'm open to other suggestions.

Daniel Harris
  • 1,805
  • 10
  • 45
  • 63

3 Answers3

71

Word wrap is available in Eclipse Neon IDE: https://www.eclipse.org/neon/noteworthy/#_word_wrap_in_text_editors.

Just consider using the latest version.

Keyboard shortcut: Alt+Shift+Y

Or button:

enter image description here

Or menu Window > Editor > Toggle Word Wrap:

enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Mickael
  • 3,506
  • 1
  • 21
  • 33
  • 14
    But as default it is disabled. When I enable it and open new file, it is disabled again. – Phoca Oct 03 '17 at 21:43
  • Indeed. Please consider creating an enhancement request (via bugs.eclipse.org ) to suggest the setting to be global and propagated to all editors. – Mickael Oct 04 '17 at 05:28
  • The shortcut Alt + Shift + Y works in S32 Design studio based on the eclipse framework. – Harsha J K Aug 14 '18 at 06:22
  • I don't see this in Mars.2 Release (4.5.2) – Mayur Dighe Sep 30 '21 at 11:05
  • Mars 2 is seriously outdated; it's been release more than 6 years ago, and 16 major release took place since then. You won't ever get more support for it. Just drop it and use latest release. – Mickael Sep 30 '21 at 15:33
  • Using STS 4, word wrap isn't listed in menus but Alt-Shift-Y works. – Adam D. Aug 07 '23 at 14:37
49

As pointed out by @KrisWebDev in this answer, Eclipse supports soft line/word wrapping as of Eclipse Neon but the GUI to control this setting does not exist yet. There should be a global settings to enable soft word wrapping by default in any text editor in Window > Preferences > General > Editors > Text Editors > Enable Wordwrap and it is not there.

Instead, you have to manually edit the org.eclipse.ui.editors.prefs file (.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs) in your eclipse workspace. There, you can add the settings wordwrap.enabled=true.

Community
  • 1
  • 1
Emmanuel Guiton
  • 1,315
  • 13
  • 24
  • 10
    on windows installations, the file is in the workspace at \.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.editors.prefs – simpleuser May 12 '17 at 03:12
  • 2
    The GUI is still not there as of Eclipse Oxygen :-/ – Emmanuel Guiton Jul 31 '17 at 08:05
  • 6
    Note that the option is not there _intentionally_ until [bug 484142](https://bugs.eclipse.org/bugs/show_bug.cgi?id=484142) gets resolved - in short, in order to avoid potential persisting slowness, every newly editor has got the word wrap feature turned off as a workaround for now. – Petr Bodnár Aug 16 '17 at 09:00
  • Thanks for the notice about the bug, I added my vote on it. – Emmanuel Guiton Aug 16 '17 at 12:35
  • 1
    @EmmanuelGuiton This setting enables word wrap for code editors. How to permanently enable word wrap for console logs? – neeraj Aug 22 '17 at 09:33
  • @neeraj I do not know if there is an option for that. – Emmanuel Guiton Aug 28 '17 at 12:33
  • 1
    @neeraj by the way : this is another topic, you should open a new question for that. – Emmanuel Guiton Sep 22 '17 at 08:50
  • 2
    It worked for Oxygen as of Nov 07, 2017. After adding the value in the org.eclipse.ui‌​.editors.prefs file lines were wrapped. – Kiran Nov 07 '17 at 09:14
  • 1
    @neeraj You can set the preferences for Run/Debug Console to a fixed width like 120 characters. It doesn't break at word boundaries, though, it just prints exactly 120 characters and continues on the next line. – Noumenon Mar 20 '20 at 02:21
  • my org.eclipse.ui.editors.prefs file gets overwritten at restart. I'm using the 2021-03 edition of Eclipse – LargeDachshund May 15 '21 at 16:41
  • I don't see this in Mars.2 Release (4.5.2) – Mayur Dighe Sep 30 '21 at 11:05
1

For windows this worked for me(change workspace6 if not works), open settings file

%APPDATA%\DBeaverData\workspace6\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.editors.prefs

add

wordwrap.enabled=true
Ali Karaca
  • 3,365
  • 1
  • 35
  • 41