Tuesday, December 25, 2012

Re: Regex for matching the section in vim help files

On 2012–12–25 Christian Brabandt wrote:

> > Is there anything built in I could use instead?
>
> Can't you search for the tag

Which tag? I want to create a table of contents for *all* sections.

> and extract the info from this line or the line following it?

That's what my question is about. Finding the section lines is easy.
But (at least for me) it's hard to extract the title. My current
regex for section without numbering is as follows:

^\(\s*\<\w\+\)\+\ze\s\+\*\<\w\+-\w\+-\w\+\*$

(yes, my jump marks always contain two dashes)
This works fine, except for non-ASCII characters or apostrophes.

I wonder, how do other people create their TOCs? Having read a
few plugin help pages I assume that everyone comes up with a custom
solution, since all tables look different.

Marco

No comments:

Post a Comment