Word wrap -- is it like vim's 'linebreak'?

176 views
Skip to first unread message

jessejazza

unread,
Nov 16, 2012, 6:15:15 PM11/16/12
to nicee...@googlegroups.com
OS - linux xubuntu 12.04LTS

I've just been looking at ne this evening. i can't work out how the wordwrap functions. I've been looking for a console editor that will do what i call 'softwrap. i.e. similar to leafpad, gedit which displays the wrapped text but saves it as single line. Nano for example will wrap with ^W^J but then save with 'returns' at each line end.

I'm a writer so this is important to me whereas a programmer would want single line.

thanks
james

Sebastiano Vigna

unread,
Nov 16, 2012, 7:39:19 PM11/16/12
to nicee...@googlegroups.com
On 17 Nov 2012, at 12:15 AM, jessejazza <jesseja...@gmail.com> wrote:

> OS - linux xubuntu 12.04LTS
>
> I've just been looking at ne this evening. i can't work out how the wordwrap functions. I've been looking for a console editor that will do what i call 'softwrap. i.e. similar to leafpad, gedit which displays the wrapped text but saves it as single line. Nano for example will wrap with ^W^J but then save with 'returns' at each line end.

No, we do hard wrapping. There are good reasons for both approaches, but if you program and write in LaTeX (as I do) hard wrapping is fundamental to let tools like svn do their job when computing and showing incremental changes. Long lines are a disaster.

Ciao,

seba

John Gabriele

unread,
Nov 16, 2012, 11:22:04 PM11/16/12
to nicee...@googlegroups.com
Hi James,

As you've noted, some editors will "line wrap" long lines, so that you
can see the whole line displayed in the editor (continued visually on
the next line, even though there's really no newlines in the line). ne
doesn't do this.

ne has a "Paragraph" command which adds/removes/moves-around newlines
to make all the lines in a paragraph about the same length. Some other
editors call this "reflow", "reformat", "justify", or
"fill-paragraph".

Also, you can set up ne to automatically insert newlines for you while
you type (when you get near the right margin) by enabling ne's
"WordWrap" pref. This is often referred to elsewhere as "automatic
line-breaking" (Emacs calls it "Auto Fill Mode"). In ne, you can set
the column number where it wraps (see the RightMargin command).

(To me, ne's naming seems a bit strange here: I'd expect "WordWrap" to
instead be named "AutoLineBreak".)

What should work out well for you is to just set your RightMargin (to,
say, 72), enable WordWrap, and then save those default preferences.
Then you can type away with wild abandon, just like before, and ne
will automatically give you nicely sized lines. This way, both you and
your tools should be pretty happy. :)

---John

jessejazza

unread,
Nov 17, 2012, 2:30:07 PM11/17/12
to nicee...@googlegroups.com
Thanks both of you for your replies. It would seem that all editors apart from emacs and vim are intended for programmers/coders with hard wrap being their requirement.

John thanks for explaining the wordwrap but it doesn't do what i was hoping. It just seems strange to me that the graphical editors will save with 'softwrap' but none of the console ones.

--james

John Gabriele

unread,
Nov 17, 2012, 5:27:35 PM11/17/12
to nicee...@googlegroups.com
On Sat, Nov 17, 2012 at 2:30 PM, jessejazza <jesseja...@gmail.com> wrote:
> On Saturday, November 17, 2012 4:22:05 AM UTC, John Gabriele wrote:
>>
>> What should work out well for you is to just set your RightMargin (to,
>> say, 72), enable WordWrap, and then save those default preferences.
>> Then you can type away with wild abandon, just like before, and ne
>> will automatically give you nicely sized lines. This way, both you and
>> your tools should be pretty happy. :)
>>
>
> Thanks both of you for your replies. It would seem that all editors apart
> from emacs and vim are intended for programmers/coders with hard wrap being
> their requirement.
>
> John thanks for explaining the wordwrap but it doesn't do what i was hoping.
> It just seems strange to me that the graphical editors will save with
> 'softwrap' but none of the console ones.

Hi James,

Since GUI editors like leafpad live in resizeable windows (with
line-wrapping), I can see how it might be convenient to use long lines
and then just resize the window to display them at whatever width
seems comfortable.

With terminal-based editors, I think it's probably more common set
your editor to have some sensible right-margin setting, and then
either use auto line-breaking while typing, or else use a reformat
command every so often on the paragraphs you're working on. This way,
regardless of how overly-wide your terminal window may be, the lines
are all still at a nice readable width.

You might give this way of working a try. Programmer's text editors
tend to be line-based --- their commands work with lines (go to
beginning of line, end of line, select line, delete line, etc.). You
might find that --- once you become familiar with the editor's
keyboard shortcuts and commands --- it's easier to work with (what I
think of as) regular lines and newlines instead of long lines.

---John
Reply all
Reply to author
Forward
0 new messages