You can use the atom /\&. This is like forcing two different regular atoms to match at the same position.
Now it becomes a bit complicated, since the cursor position can be anywhere inside the <<..>>
and then you also want to allow whitespace inside those <<..>>
. This makes it a bit complex to match the correct item if there are several matches in a line.
So instead of using .\{-\}
to allow an arbitrarily long number of matches (even other <<
), you need to restrict your match to only match until the >>
.
To make the pattern simpler, let's for now assume all characters are allowed except for >
. That would make the pattern like this:
/<[^>]\+>>\&[^>]*\%#[^>]*>>
which means <
followed by any character except >
([^>]
) and at the same time (\&
) allow any character except >
, followed by the cursor position (\%#
), followed by any character except >
followed by >>.
Now you can make this more complicated by enforcing the >>
delimiter. Possible search patterns are \(>>\)\@!
(not followed by >>
) or the already mentioned \([^>]\|>[^>]\)
. However this will make your search pattern a lot more complex, so this is left as an exercise to the reader ;)
You might also want to have a look at the distributed plugin LogiPat, which allows to construct patterns using logical operators (and, or, not, etc).
<<
?