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: <space><tab><space>aaaa aaa aaaaaa Nikolai W's modifies that to "start the line with exactly three spaces"; the rest is the same. example: <space><space><space>aaa aaaaaa aaa Yours: start the line with exactly three spaces, followed by two or three lower case characters, which then terminates the line. example: <space><space><space>aa
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
