syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Nikolai Weibull

The manSubHeading is defined as

syn match  manSubHeading  ^\s\{3\}[a-z][a-z ]*[a-z]$

This will, however, match more lines than I think is intended.  It
will, for example, match the line

\t  returns are what are recorded and compared with the data git keeps

where \t is a horizontal tabulation.  I'm guessing that the actual
regex should be

 ^ \{3\}[a-z][a-z ]*[a-z]$

but I'm not sure; I haven't been able to find a reference for the
display of manual pages.

Anyone have any insight into this issue?

 nikolai


Re: syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Charles E Campbell Jr

Nikolai Weibull wrote:


The manSubHeading is defined as

syn match  manSubHeading  ^\s\{3\}[a-z][a-z ]*[a-z]$

This will, however, match more lines than I think is intended.  It
will, for example, match the line

\t  returns are what are recorded and compared with the data git keeps

where \t is a horizontal tabulation.  I'm guessing that the actual
regex should be

 ^ \{3\}[a-z][a-z ]*[a-z]$

but I'm not sure; I haven't been able to find a reference for the
display of manual pages.

Anyone have any insight into this issue?


I suggest bringing up syntax highlighting issues for a specific filetype 
with the syntax highlighting file's maintainer.
In this case, by looking at syntax/man.vim, its:  Gautam H. Mudunuri 
gmudunur AT informatica.com.


Regards,
Chip Campbell



Re: syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Nikolai Weibull

On 4/9/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote:


In this case, by looking at syntax/man.vim, its:  Gautam H. Mudunuri
gmudunur AT informatica.com.


Actually, this was actually the wrong maintainer.  Gautam was the
previous maintainer of this file.  Nam SungHyun [EMAIL PROTECTED]
maintains it now.

 nikolai


Re: syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Ian Tegebo

On 4/9/07, Nikolai Weibull [EMAIL PROTECTED] wrote:

The manSubHeading is defined as

syn match  manSubHeading  ^\s\{3\}[a-z][a-z ]*[a-z]$

This will, however, match more lines than I think is intended.  It
will, for example, match the line

\t  returns are what are recorded and compared with the data git keeps

where \t is a horizontal tabulation.  I'm guessing that the actual
regex should be

  ^ \{3\}[a-z][a-z ]*[a-z]$

I hope nobody minds if I take this opportunity to ask a question about
vim's pattern matching.

After reading |pattern| I wonder if the following is more efficient:

syn match manSubHeading '^ \{3\}\l\l\?\l$'

Taken from |pattern|:

   - Matching with a collection can be slow, because each character in
 the text has to be compared with each character in the collection.
 Use one of the other atoms above when possible.  Example: \d is
 much faster than [0-9] and matches the same characters

Do people find this to make a different for moderate file sizes, e.g.
the man page for 'less' being ~2000 lines?

--
Ian Tegebo


Re: syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Nikolai Weibull

On 4/9/07, Ian Tegebo [EMAIL PROTECTED] wrote:

On 4/9/07, Nikolai Weibull [EMAIL PROTECTED] wrote:



   ^ \{3\}[a-z][a-z ]*[a-z]$
I hope nobody minds if I take this opportunity to ask a question about
vim's pattern matching.

After reading |pattern| I wonder if the following is more efficient:

syn match manSubHeading '^ \{3\}\l\l\?\l$'


Yes, and it may be more correct as well, at least in the first and
last instance.  However, the second part may also contain a space, so
\l isn't correct there; and I don't know where you get that \? from.
This is the correct pattern:

 ^ \{3}\l[[:alpha:] ]*\l$

(I also noticed that the apparently accepted \{m\} is being used in
this file instead of the documented \{m})

One can of course ask oneself if a subsection heading must consist of
at least two letters.  I'm guessing that the intent was to force the
line to end with a non-space:

 ^ \{3}\l\%([[:alpha:] ]*\l\)\=$

In fact, I'd prefer it be written as

 ^ \{3}\a\%([[:alpha:] ]*\a\)\=$

as 'syn case ignore' is on, \l and \a will be the same.  However, \a
meshes better with [:alpha:] and may, depending on how all this is
implemented, be a miniscule amount faster.


Taken from |pattern|:

- Matching with a collection can be slow, because each character in
  the text has to be compared with each character in the collection.
  Use one of the other atoms above when possible.  Example: \d is
  much faster than [0-9] and matches the same characters

Do people find this to make a different for moderate file sizes, e.g.
the man page for 'less' being ~2000 lines?


Probably not.

 nikolai