Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fixing Thunderbird, gVim and Windows line lengths with something like the Linux fmt command

27 views
Skip to first unread message

Oliver

unread,
Feb 11, 2024, 1:05:32 PMFeb 11
to
Thunderbird drives me nuts with its inability to set a line length.
(I turned off the HTML long ago which was incapable of correct line feeds).

gVim can set line length, but I can't figure out how yet as this should
work but it doesn't "do anything" unless you're typing already on the line.
:set textwidth=80

The good news is this doesn't truncate words when it works but it
doesn't really work because you have to be _editing_ the line to work.

What I do now every time I send a message that has to look nice from
Thunderbird is write it up in Thunderbird first. Then I cut it out of the
Thunderbird message (which usually has quoted context that I leave alone).

Then I paste that new content into Windows gVim.
And then I manually adjust each line's line length to look good.

Then I paste it back into the brain dead Thunderbird.
Then it looks the way I want (which is simply 80 character line lengths).

Obviously this sucks.
There must be a better way (and no, HTML styles is NOT that better way).

In Linux you can use the ":!fmt" command to format to 80 characters.
It too will truncate at a space (and not in the middle of a word).

But Windows doesn't have the capability (as far as I know), unless, of
course, I go back 30 years to install CYGWIN or the like (which is crazy).

I can also use WSL if I install it but really all I'm asking for is one of
two basic switches, one in Thunderbird which almost certainly doesn't
exist, the other in gVim which probably exists - but I don't know how to
use it.

Is there a setting to make Thunderbird line lengths 80 characters?
Is there a way to essentially !fmt Windows gVim to 80 characters?

Paul

unread,
Feb 11, 2024, 1:36:26 PMFeb 11
to
mailnews.send_plaintext_flowed Boolean (my preference today is False)

mailnews.wraplength Integer (my preference today is 1000)

Find a test newsgroup, like eternal-september.test or the
like, and practice your craft until it works the way you want.

See also, the "Advanced" section here.

https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird

Paul

Frankie

unread,
Feb 11, 2024, 1:55:29 PMFeb 11
to
On 11/2/2024, Oliver wrote:

> Is there a setting to make Thunderbird line lengths 80 characters?
> Is there a way to essentially !fmt Windows gVim to 80 characters?

Thunderbird can actually set the line length in FORWARDED messages.
So what I do for the same problem is I use that hidden feature.

1. You compose the message but before you send it out
2. You forward it to yourself first
3. Then you copy what was forwarded to the original & send it out

Unfortunately for whatever reason you can't just pretend to forward.
You have to actually receive your own forwarded message to get the benefit
of the hidden feature in Thunderbird to compose short line lengths.

Someday Thunderbird developers will learn not everyone wants html to do all
their formatting for them but that day is still a long ways away.

Frank Slootweg

unread,
Feb 11, 2024, 2:29:31 PMFeb 11
to
Oliver <ol...@invalid.net> wrote:
> Thunderbird drives me nuts with its inability to set a line length.
> (I turned off the HTML long ago which was incapable of correct line feeds).
>
> gVim can set line length, but I can't figure out how yet as this should
> work but it doesn't "do anything" unless you're typing already on the line.
> :set textwidth=80

It's probably best to set a line length (textwidth in vim) and then set
a wrapmargin from that line length, i.e.

:set textwidth=80
:set wrapmargin=8

So you have a textwidth of 80 characters, but the text starts wrapping
at column 72.

Be sure to check the settings by using the same commands without the
'=...' part, i.e.

:set textwidth
:set wrapmargin

> The good news is this doesn't truncate words when it works but it
> doesn't really work because you have to be _editing_ the line to work.

You probably want to be able to reformat a section while you're
composing/editing. Use

:set fo=tcrq

Now you can select a section by Ctrl-V and moving the cursor down over
as many lines of text as you want and then use 'gq' (without quotes) to
reformat the selected lines within the given textwidth and wrapmargin.

> What I do now every time I send a message that has to look nice from
> Thunderbird is write it up in Thunderbird first. Then I cut it out of the
> Thunderbird message (which usually has quoted context that I leave alone).
>
> Then I paste that new content into Windows gVim.
> And then I manually adjust each line's line length to look good.
>
> Then I paste it back into the brain dead Thunderbird.
> Then it looks the way I want (which is simply 80 character line lengths).
>
> Obviously this sucks.
> There must be a better way (and no, HTML styles is NOT that better way).

I *start* in vim, because it's a real editor unlike the Thunderbird's
built-in composer, and then I copy-and-paste the text into Thunderbird's
compose window. (I often do it via an intermediate copy from Notepad, so
close vim, open the textfile in Notepad and copy-and-paste from Notepad
to Thunderbird.)

Still quite cumbersome, but as I don't need that too often, I live
with it. (If somebody knows a way to invoke vim instead of TB's compose
window, please say so.)

> In Linux you can use the ":!fmt" command to format to 80 characters.

See the ':set fo=tcrq' setting. I used to use fmt in the dark ages,
but with vim (instead of vi) it's not needed.

> It too will truncate at a space (and not in the middle of a word).
>
> But Windows doesn't have the capability (as far as I know), unless, of
> course, I go back 30 years to install CYGWIN or the like (which is crazy).

For historical reasons, I use Cygwin, but the Windows version of
[g]vim should be able to do what I have described.

> I can also use WSL if I install it but really all I'm asking for is one of
> two basic switches, one in Thunderbird which almost certainly doesn't
> exist, the other in gVim which probably exists - but I don't know how to
> use it.
>
> Is there a setting to make Thunderbird line lengths 80 characters?

Some way, mine is set to 72 characters, but I don't know where.

> Is there a way to essentially !fmt Windows gVim to 80 characters?

Explained above.

Stan Brown

unread,
Feb 11, 2024, 3:56:35 PMFeb 11
to
On Sun, 11 Feb 2024 11:05:29 -0700, Oliver wrote:
> gVim can set line length, but I can't figure out how yet as this should
> work but it doesn't "do anything" unless you're typing already on the line.
> :set textwidth=80

While you're typing Vim or gvim will insert a hard carriage return
before a word that contains the 81st character on a line (based on
your example of :set tw=80). BTW, 80 is probably too long for
monospace characters to be read comfortably.

> The good news is this doesn't truncate words when it works but it
> doesn't really work because you have to be _editing_ the line to
> work.

Not quite accurate, I'm afraid.

1. It's not just any "editing" but the very specific act of inserting
or appending characters. Editing commands like :s never trigger
breaking the line (unless of course your replacement text contains
\r, which is a line split).

2. Even when editing or appending, if your new characters don't
actually cross over the "textwidth"th character, the line won't be
broken.

3. You can of course rewrap previously typed lines, with the gq
command. Again, the rewrap inserts hard returns.

--
Stan Brown, Tehachapi, California, USA https://BrownMath.com/
Shikata ga nai...

Oliver

unread,
Feb 11, 2024, 4:58:01 PMFeb 11
to
On Sun, 11 Feb 2024 12:56:32 -0800, Stan Brown <the_sta...@fastmail.fm>
wrote

> 3. You can of course rewrap previously typed lines, with the gq
> command. Again, the rewrap inserts hard returns.

I can't get "gq" to work. It says "Not an editing command :gq".
Can you explain how it would work in a typical gvim session?

1. I compose a lengthy diatribe in gvim without line length worries.
2. I've pasted extra stuff into that treatise, with other line lengths.
3. Now I want to format the whole mess into nice neat lines using
:set textwidth=80
:set wrapmargin=8

What exactly do I do because everything I've just tried doesn't do it.

Daniel65

unread,
Feb 12, 2024, 4:13:12 AMFeb 12
to
Oliver wrote on 12/2/24 5:05 am:
Oliver, I use SeaMonkey Suite, which is based (a long time ago) on
Mozilla Suite which is were both Firefox and Thunderbird branched from
(a long time ago) .....

However on my SeaMonkey Suite, if I wanted to change the line length,
I'd go to Edit -> Preferences -> Mail & Newsgroups -> Composition ....
and, on that page, I can set the 'Wrap plain text messages at XXX
characters'

I think (but don't quote me) in Thunderbird the Preferences screen
appears on the 'Options' drop-down menu.
--
Daniel

Frank Slootweg

unread,
Feb 12, 2024, 9:51:28 AMFeb 12
to
Oliver <ol...@invalid.net> wrote:
> On Sun, 11 Feb 2024 12:56:32 -0800, Stan Brown <the_sta...@fastmail.fm>
> wrote
>
> > 3. You can of course rewrap previously typed lines, with the gq
> > command. Again, the rewrap inserts hard returns.
>
> I can't get "gq" to work. It says "Not an editing command :gq". Can
> you explain how it would work in a typical gvim session?

Oops! In my earlier response, I said to use Ctrl-V, but it is Shift-V,
i.e an upper-case 'V'.

That said, ...

You use 'gq' when you're *not* in insert mode and it's not a colon command, so not ':gq' but just 'gq' (without quotes). See my earlier
response on how to select a section with Shift-V and the cursor key(s).

Specifically: If I want to reformat the badly formatted (first line is
too long) paragraph I just typed, I exit insert mode (esc), move the
cursor to the 'Y' of 'You', type Shift-V ('V') (press and hold Shift and
hit the 'V" key), the first line is now highlighted (in my case in
inverse video), now use the cursor keys(s) to move over the section of
text to be selected - i.e. in this case one time the cursor down key, so
all two lines are hightlighted, finally - at the end of the selection
(i.e. the dot at the end of 'key(s).' is within the selected area), hit
the 'g' and 'q' keys, the selected section will now be reformatted. and
the result will be:

<reformatted>
You use 'gq' when you're *not* in insert mode and it's not a colon
command, so not ':gq' but just 'gq' (without quotes). See my earlier
response on how to select a section with Shift-V and the cursor key(s).
</reformatted>

You can also mark the area to be selected with the 'mouse' or/and with
other cursor key(s), i.e. for example mark from bottom to top instead
of from top to bottom. And you can of course mark parts of a paragraph
instead of the whole paragraph.

> 1. I compose a lengthy diatribe in gvim without line length worries.
> 2. I've pasted extra stuff into that treatise, with other line lengths.
> 3. Now I want to format the whole mess into nice neat lines using
> :set textwidth=80
> :set wrapmargin=8
>
> What exactly do I do because everything I've just tried doesn't do it.

HTH.

Stan Brown

unread,
Feb 12, 2024, 5:35:52 PMFeb 12
to
On Sun, 11 Feb 2024 14:57:58 -0700, Oliver wrote:
> I can't get "gq" to work. It says "Not an editing command :gq".

The command is gq, not :gq. Some commands have colons and you
construct them on the Vim command line; others do not because you
don't. There's a gq but no :gq; however there's both an f and an :f,
a q and a :q. Fun!

Type ":help gq" or ":h gq". It will point out that the command
requires a "motion" to indicate the scope of the reformatting. (Some
examples, from me not the help file: gq$ for reformatting to end of
line; gq} through end of paragraph; gqG through end of file.)

When you're having trouble with a command, always use the help
system. The text is dense, but I've found if I take a deep breath and
read carefully it will lead me to a solution to my problem.

Stan Brown

unread,
Feb 12, 2024, 5:46:37 PMFeb 12
to
On Mon, 12 Feb 2024 20:13:11 +1100, Daniel65 wrote:
> Oliver, I use SeaMonkey Suite, which is based (a long time ago) on
> Mozilla Suite which is were both Firefox and Thunderbird branched from
> (a long time ago) .....
>
> However on my SeaMonkey Suite, if I wanted to change the line length,
> I'd go to Edit -> Preferences -> Mail & Newsgroups -> Composition ....
> and, on that page, I can set the 'Wrap plain text messages at XXX
> characters'
>
> I think (but don't quote me) in Thunderbird the Preferences screen
> appears on the 'Options' drop-down menu.

I think that user to be a setting in the GUI, but it's diverged from
that considerably since you last used it.

Now, you click the hamburger near the upper right, select Settings
and then Composition, only to find that there's no setting like the
one you mention. A search for "wrap" (no quotes) in the box at the
upper right comes up empty.

As Jörg Knobloch has posted -- as far as I know it's the only way --
one must into Settings » General » Config Editor and set
mailnews.wraplength.

Stan Brown

unread,
Feb 12, 2024, 7:01:47 PMFeb 12
to
On Sun, 11 Feb 2024 14:57:58 -0700, Oliver wrote:
> I can't get "gq" to work. It says "Not an editing command :gq".
> Can you explain how it would work in a typical gvim session?
>
> 1. I compose a lengthy diatribe in gvim without line length worries.
> 2. I've pasted extra stuff into that treatise, with other line lengths.
> 3. Now I want to format the whole mess into nice neat lines using
> :set textwidth=80
> :set wrapmargin=8
>
> What exactly do I do because everything I've just tried doesn't do it.

Just a note: There is a comp.editors newsgroup, and nearly every
article of its infrequent traffic is about Vim. You might get good
help there, specifically about how to shorten the learning curve.

Oliver

unread,
Feb 12, 2024, 9:09:32 PMFeb 12
to
On Mon, 12 Feb 2024 14:46:33 -0800, Stan Brown <the_sta...@fastmail.fm>
wrote

> as far as I know it's the only way --
> one must into Settings > General > Config Editor and set
> mailnews.wraplength.

Mine is set to 72 and it doesn't do shit so there must
be more to it than just that for sending email that
you want to be really formatted to 80 characters
(with intelligent breaks at spaces and punctuation).

If you want to know what any setting of mine is, just ask
as I would love for Thunderbird's editor NOT to be sending
long lines when I don't want it to be sending them.

Thunderbird Hamburger > Settings > Search for "Config editor".
mailnews.wraplength = 72

Oliver

unread,
Feb 12, 2024, 9:13:16 PMFeb 12
to
On Mon, 12 Feb 2024 14:35:49 -0800, Stan Brown <the_sta...@fastmail.fm>
wrote

> The command is gq

I'm doing something wrong as when I type "gq" inside of a gvim session, the
whole page goes blank.

1. Edit something ugly
2. Place cursor arbitrarily on a long line & press escape
3. gq

Nothing happens.

Now try selecting stuff.
1. Press escape & then select a long line paragraph with the mouse
2. gq

The whole paragraph disappears.

What am I doing wrong?

Jörg Lorenz

unread,
Feb 13, 2024, 12:39:29 AMFeb 13
to
mailnews.display.disable_format_flowed_support true
plain_text.wrap_long_lines true
mailnews.send_plaintext_flowed false

HTH, Jörg

--
"Ave Caesar! Morituri te salutant!"

dillinger

unread,
Feb 13, 2024, 1:38:06 AMFeb 13
to
Try also setting "mailnews.send_plaintext_flowed" to false, that seems
to work, sort of.

Oliver

unread,
Feb 13, 2024, 2:57:11 AMFeb 13
to
On Tue, 13 Feb 2024 06:39:26 +0100, Jörg Lorenz <hugy...@gmx.net> wrote

>> Thunderbird Hamburger > Settings > Search for "Config editor".
>> mailnews.wraplength = 72
>
> mailnews.display.disable_format_flowed_support true
> plain_text.wrap_long_lines true
> mailnews.send_plaintext_flowed false

Thanks for those settings as I would love for Thunderbird to just work.

There's no way I want its HTML garbage though, but here's what I have
before I make any changes as suggested (just in case I have to revert).

mailnews.wraplength = 72
mailnews.display.disable_format_flowed_support false
plain_text.wrap_long_lines true
mailnews.send_plaintext_flowed true

Bearing in mind the line feeds are atrociously implemented in Thunderbird
email (the developers don't have a clue how to write an editor), I'll
change it to what you suggest and test it out for a day. Thanks.

Oliver

unread,
Feb 13, 2024, 3:46:33 AMFeb 13
to
On Tue, 13 Feb 2024 07:28:58 +0100, dillinger <dill...@invalid.not> wrote

>> Thunderbird Hamburger > Settings > Search for "Config editor".
>> mailnews.wraplength = 72
>
> Try also setting "mailnews.send_plaintext_flowed" to false, that seems
> to work, sort of.

Wow. Thanks everyone. I take back all the bad things I said about the
Thunderbird developers not knowing how to write a composition tool.

Changing from
mailnews.wraplength = 72
mailnews.display.disable_format_flowed_support false
plain_text.wrap_long_lines true
mailnews.send_plaintext_flowed true

Changing to
mailnews.wraplength = 72
mailnews.display.disable_format_flowed_support true
plain_text.wrap_long_lines true
mailnews.send_plaintext_flowed false

Already made a world of positive difference!

It's too early to declare the war over, but the first test I ran sure
looked like what I wanted which is simply for me to type away with abandon
and for Thunderbird to format to an intelligent reasonably sized line
lengths.

I'll test for a few more days under varying conditions, but this is already
a huge improvement on what was happening prior to those two changes above.

Carlos E.R.

unread,
Feb 13, 2024, 8:12:36 AMFeb 13
to
On 2024-02-13 03:09, Oliver wrote:
> On Mon, 12 Feb 2024 14:46:33 -0800, Stan Brown <the_sta...@fastmail.fm>
> wrote
>> as far as I know it's the only way -- one must into Settings�> General
>> > Config Editor and set mailnews.wraplength.
>
> Mine is set to 72 and it doesn't do shit so there must
> be more to it than just that for sending email that you want to be
> really formatted to 80 characters (with intelligent breaks at spaces and
> punctuation).

It does work. Look at the source of this message you posted:

Mine is set to 72 and it doesn't do shit so there must
be more to it than just that for sending email that
you want to be really formatted to 80 characters
(with intelligent breaks at spaces and punctuation).

which is not as is displayed by Thunderbird (before hitting reply or
followup.


>
> If you want to know what any setting of mine is, just ask
> as I would love for Thunderbird's editor NOT to be sending
> long lines when I don't want it to be sending them.
>
> Thunderbird Hamburger > Settings > Search for "Config editor".
> mailnews.wraplength = 72

--
Cheers, Carlos.

0 new messages