Inhibiting numbered list recognition with auto-format

12 views
Skip to first unread message

martin f krafft

unread,
Jun 10, 2019, 10:23:55 PM6/10/19
to vim help list
Hi folks,

I am using Vim successfully for composing format=flowed emails (for
mutt), i.e. I have formatoptions+=aw in place. I also use
$formatlistpat, and now I often get into the situation wherein an
abbreviation like "e.g." or "i.e." or whatever at the start of a
line makes Vim thinks it's a numbered list within a flowed
paragraph. Here's an example, and I'm using the '·' character to
highlight the trailing/leading spaces of the lines:

This is an example to show how using Vim to compose a·
format=flowed email can yield problems when abbreviations like·
e.g. are used and end up at the start of a line, because it'll·
·····make Vim think that there's a numbered list starting.

I understand why this is happening, but I'd say that it shouldn't
happen in cases where the previous line ended with a trailing space,
at least not if $formatoptions includes 'w'.

Unfortunately, I cannot seem to get $formatlistpat to recognise
context across linebreaks.

The relevant configuration I'm using is:

formatlistpat=^\v\s*(((\a|\d{,4})[]:.)}/-])+|[-\*.·→+])\s+
formatoptions=tcqawn
autoindent

Do you see any way to prevent the auto-indentation from happening in
the middle of format=flowed paragraphs?

Thanks,

--
@martinkrafft | https://riot.im/app/#/room/#madduck:madduck.net

"i dislike arguments of any kind. they are always vulgar, and often
convincing."
-- oscar wilde

spamtraps: madduc...@madduck.net
digital_signature_gpg.asc

Ruben Safir

unread,
Jun 11, 2019, 11:32:01 PM6/11/19
to vim...@googlegroups.com
On 6/10/19 10:23 PM, martin f krafft wrote:
>
>  formatlistpat=^\v\s*(((\a|\d{,4})[]:.)}/-])+|[-\*.·→+])\s+

can you expound on this?


--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

martin f krafft

unread,
Jun 12, 2019, 8:35:10 AM6/12/19
to Ruben Safir, vim...@googlegroups.com
Quoting "Ruben Safir", who wrote on 2019-06-11 at 23:30 Uhr -0400:
>>  formatlistpat=^\v\s*(((\a|\d{,4})[]:.)}/-])+|[-\*.·→+])\s+
>can you expound on this?

It's my regular expression to capture all the different ways I might use to
enumerate lists.

What do you mean by "expound"?

Using ExplainPattern?

Pattern: ^\v\s*(((\a|\d{,4})[]:.)}/-])+|[-\*.·→+])\s+
Magic Pattern: ^\s*\(\(\(\a\|\d\{,4}\)[]:.)}/-]\)\+\|[-\*.·→+]\)\s\+
^ (assertion) require match at start of line
\s whitespace character: <Space> and <Tab>
* (multi) zero or more of the preceding atom
\( start of first capturing group
| \( start of second capturing group
| | \( start of third capturing group
| | | \a alphabetic character: [A-Za-z]
| | | \| OR (separate alternatives)
| | | \d digit: [0-9]
| | | \{,4} (multi) N to M, greedy
| | \) end of group
| | []:.)}/-] collection
| \) end of group
| \+ (multi) one or more of the preceding atom
| \| OR (separate alternatives)
| [-\*.·→+] collection
\) end of group
\s whitespace character: <Space> and <Tab>
\+ (multi) one or more of the preceding atom
"the surest way to corrupt a youth is to instruct him to hold in
higher esteem those who think alike than those who think
differently."
-- friedrich nietzsche

spamtraps: madduc...@madduck.net
digital_signature_gpg.asc
Reply all
Reply to author
Forward
0 new messages