Formatting numbered lists within comments

0 views
Skip to first unread message

Cory Echols

unread,
Dec 4, 2008, 2:26:06 PM12/4/08
to vim...@googlegroups.com
I'm trying to get numbered lists to format in code comments similar to
how they format in plain text:

// 1. Similar to this formatted
// list in this paragraph.

I have the following settings:

formatoptions=croqln
comments=://
formatlistpat=^\s*\d\+[\]:.)}\t ]\s*

These options are not working. The second line of the numbered item
is beginning directly underneath the '1'.

Matt Wozniski

unread,
Dec 4, 2008, 4:17:06 PM12/4/08
to vim...@googlegroups.com

The problem is that the pattern /^\s*\d\+[\]:.)}\t ]\s*/ doesn't match
'// 1. Similar to this formatted' - the leading comment characters
confuse it.

:let &flp='^\s*\%(\/[\/*]\s*\)\=\d\+[\]:.)}\t ]\s*'

does a better job, but still messes up:

// 1. Similar to this formatted list in
// this paragraph

This is as far as I can get with it at the moment... someone else
might know more about it and be able to take it from there...

~Matt

fritzophrenic

unread,
Dec 4, 2008, 4:20:03 PM12/4/08
to vim_use


On Dec 4, 3:17 pm, "Matt Wozniski" <m...@drexel.edu> wrote:
>
> :let &flp='^\s*\%(\/[\/*]\s*\)\=\d\+[\]:.)}\t ]\s*'
>
> does a better job, but still messes up:
>
> // 1. Similar to this formatted list in
>       // this paragraph
>
> This is as far as I can get with it at the moment... someone else
> might know more about it and be able to take it from there...
>

You take it from here to create an entirely new formatexpr,
unfortunately.

This has been discussed in the past:

http://groups.google.com/group/vim_use/browse_thread/thread/91b0a9a7ac557745/7863492167b0be72
Reply all
Reply to author
Forward
0 new messages