This is what I get from the documentation: \zs
"starts the highlighted part" after matching the preceding regex, and \@<=
"starts the highlighted part" after matching the preceding atom. But I don't exactly understand the subtleties of this, so can anyone explain how they differ a bit more in depth?
This is what made me curious: If I run
/\_s\zsnnoremap
i.e. select nnoremap
preceded by a space or a start-of-line (i.e. the newline from the preceding line, hence the \_
preceding the s
) and then run gn
to enter Visual Mode and visually select the next match, for some reason only the first column (i.e. the first n
in nnoremap
) is selected -- despite the fact that the entire nnoremap
word is highlighted with :hlsearch
turned on.
However, if I instead run the search
/\_s\@<=nnoremap
and then try gn
, the entire nnoremap
is properly selected. What could be going on here? Did I discover some obscure bug?
:h patterns
but my memory suggests that regexs are composed of atoms, if that helps explain the difference.