On Tue 12-Sep-06 7:10pm -0600, you wrote:

> Bill McCarthy wrote:
>> I want to match a line containing only the word "text" and a
>> line containing only the word "endtext".
>> 
>>     let b:match_words = '^\s*text\s*$:^\s*endtext\s*$'
>> 
>> works, but '%' brings me to the beginning of the line, as
>> would be expected from those regexes.  Using '\zs' in front
>> of "text" and "endtext" causes the '%' mechanism to fail.
>> 
>> (I noticed that when I only added the '\zs' in front of the
>> first 'text', the '%' failed while on the 'text' line, but
>> worked from the 'endtext' line - even landing in the correct
>> position.)
>> 
>> How do I get matchit to move between the first 't' in 'text'
>> and the first 'e' in 'endtext'?
>> 

> I got it to work with

>    :let b:match_words =
> '\%(^\s*\)\@<=text\s*$:\%(^\s*\)\@<=endtext\s*$'

> see ":help /\@<="

Thanks, Tony.  I was just getting ready to respond to myself
with another solution I found with a hint from the help
file:

    let b:match_words =
      \'\%(\S\+\)\@<!text\s*$:\%(\S\+\)\@<!endtext\s*$'

Hint from ":help matchit-spaces"
Also      ":help /\@<!"

But I'm still wondering why '\zs' didn't work.
    
-- 
Best regards,
Bill

Reply via email to