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

2007-04-10 Thread Charles E Campbell Jr

Ian Tegebo wrote:


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$'


(snip)

The pattern you've provided isn't matching the same thing.
The current one: start the line with exactly three spaces or tabs,
followed by a lower case character, followed by any number of
lower case characters or spaces, up to a lower case character
at the end-of-line.

 example:  spacetabspace aaa aa

Nikolai W's modifies that to start the line with exactly three spaces; the
rest is the same.

 example: spacespacespaceaaa aa aaa

Yours: start the line with exactly three spaces, followed by two or three
lower case characters, which then terminates the line.

 example: spacespacespaceaa


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



Depends on the line lengths.  Your pattern would terminate quite
quickly on each line, as only 5 or 6 characters may be at the beginning
of matching lines; anything more is a mismatch.  The original and NW's
both examine the entire line; so if every line had 1GB of characters, these
two patterns would take considerably longer than yours.

Regards,
Chip Campbell




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

2007-04-10 Thread Charles E Campbell Jr

Nikolai Weibull wrote:


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.


Whoops -- yes, you're quite right.  Sorry 'bout that...

Chip Campbell



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

2007-04-10 Thread Nikolai Weibull

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

Nikolai Weibull wrote:

 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.

Whoops -- yes, you're quite right.  Sorry 'bout that...


What's worse is that that address is no longer valid.  I've tried
another address attached to one Nam SungHyun.  We'll see if he
responds.

 nikolai


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