你如何在 Eclipse 中默认启用自动换行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39597007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:40:10  来源:igfitidea点击:

How do you enable word-wrap by default in Eclipse?

eclipseidetext-editorword-wrapeclipse-neon

提问by Daniel Harris

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

简单的问题:如何在 Eclipse 中默认启用自动换行?我看了这个插件,但它只适用于 Luna。此外,这个插件是一个单独的文本编辑器,没有语法高亮或验证。我愿意接受其他建议。

回答by Mickael

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

自动换行在 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

键盘快捷键:Alt+ Shift+Y

Or button:

或按钮:

enter image description here

在此处输入图片说明

Or menu Window > Editor > Toggle Word Wrap:

或菜单窗口 > 编辑器 > 切换自动换行:

enter image description here

在此处输入图片说明

回答by Emmanuel Guiton

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 Wordwrapand it is not there.

正如@KrisWebDev在此答案中指出的那样,Eclipse 支持自 Eclipse Neon 起的软换行/自动换行,但尚不存在控制此设置的 GUI。应该有一个全局设置来默认在Window> Preferences> General> Editors> Text Editors> 中的任何文本编辑器中启用软自动换行Enable Wordwrap,但它不存在。

Instead, you have to manually edit the org.eclipse.ui.editors.prefsfile (.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.

相反,您必须在 eclipse 工作区中手动编辑org.eclipse.ui.editors.prefs文件 ( .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs)。在那里,您可以添加设置wordwrap.enabled=true