46
votes

I know there are a bunch of posts about this already, stackoverflow: word wrap in netbeans, for one, and there are some people that say it is already included in netbeans 7, but for the most part they are all old, or inconclusive. I use netbeans 7.0.1 and the included word wrap is half-assed and glitchy at best. Going to Tools > Options > Editor > Formatting > Line Wrap and setting it to either "After Words" or "Anywhere" both result in practically the same sort of wrapping and neither one is very reliable. On occasions it will wrap as expected, but more often than not you can end up with anywhere from one word to an entire paragraph past the vertical scrollbar. Is there something I am missing or is that really the way that's supposed to work?

I'm still looking and will post any significant finds, but does anyone know of a way to fix this, or a plugin to install for it, or anything? I would have figured after 4 years of inquiries (2008 is the oldest post I've found about this) netbeans would have fixed it :(

BTW: Not looking for reasons why my code shouldn't be more than 80 character long, there's no helping it sometimes and that answer isn't helpful. I have also tried adding "-J-Dorg.netbeans.editor.linewrap=true" in the netbeans.conf file, but from what I gather that is for enabling the feature in older version and did nothing in mine (I removed it).

7

7 Answers

89
votes

On Netbeans 7 and 8, you can use Tools/Options/Editor/Formatting/LineWrap.

It can only be globally enabled.

enter image description here

7
votes

you can do it from:

1) Tools -> Options -> Editor -> Formatting(Tab)

2) Select Your Language in "Language Drop down"

3) Select "Wrapping" from "Category and do what ever you want

Note: this is for Windows OS

6
votes

I have done it in netbeans 8.0
Goto -> Tools-> options-> Editor-> Formatting-> language(dropdown-All languages) -> Category(dropdown-Tabs and indents) -> Line wrap(After word)

Make sure you re-open the file to see the change.

4
votes

In case any one is looking for this with NetBeans 8 on OSX and ends up here, it's preferences/Options/Editor/Formatting/LineWrap

NetBeans8

3
votes

you can do it from:

1) Tools -> Options -> Editor -> Formatting(Tab)
2) Select Your Language in "Language Drop down"
3) Select "Tabs and Indents" from "Category
4) Dropdown" select any of the desired option from "Line Wrap drop down" i.e After words or Anywhere

Note: this is for Windows OS

2
votes

In Netbeans 7.2 it's actually, "Wrapping" instead of "Line Wrapping" and it's "If Long" instead of "After Words", but that probably doesn't answer your question.

You posted this almost one year ago, and you still haven't found anything yet?

I don't like how they decide to wrap by way of creating actual new lines in the editor. I would prefer if it just line-wrapped but you didn't have to make a new line - like, what you have with Notepad. However, I would prefer if you had a symbol to show that you're line wrapping on the next line, like I have seen in other IDE's before.

1
votes

I done in Netbeans 8.0.2 as following way : NetBeans->preferences/Options/Editor/Formatting/LineWrap

Hope this is useful.