Bill McCarthy wrote:
Hello Vim List,

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 /\@<="


Best regards,
Tony

Reply via email to