line wrap

JEditorPane line/word wrapping problem

I had a problem this weekend with the JEditorPane line wrap (word wrap), where it was wrapping lines on the right margin right in the middle of words. Wherever my sentence hit the right margin, that's where the line wrapped (with no consideration for word boundaries), leaving me with lines that looked like this:

The vim line wrap command

Vim FAQ: How do I configure Vim to wrap lines (or not wrap lines) of text?

Answer: To get Vim to not wrap text, issue the "vim set nowrap" command, like this:

:set nowrap

By default vim will wrap long lines in the editor, but this command changes that display, so long lines will now go off-screen to your right.

vim set wrap - how to get back to wrapping mode

Getting back to the vim editor's normal line wrap mode is also simple. Just issue a very similar "vim set wrap" command:

vi/vim line wrap command

Some times when you're editing a file with really long lines it's easier to work with the file if the lines don't wrap on screen. That's usually when I use the "no wrap" feature of the vi (or vim) editor.

If you don't want the lines to wrap in vi just type this command:

:set nowrap

That command tells vi not to wrap the lines. The result is that any line that was wrapped before will now scroll off the screen to the right. If you want to return it to the default wrapping mode just type this command: