You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the pattern given to a :global command is given a “starting position” (the zero-width \zs atom) at some point after a new-line atom (\n), the position of the action taken is not that of the beginning of the match (at the \zs), but instead at the beginning of the pattern.
e.g. (toy example):
first line
second line
:g`firstline\n\zssecond line`normal A!!!<1b>
first line!!!
second line
Expected behaviour
The global command should account for the actual starting position of the match, which is not always the same thing as whatever buffer position matches the beginning of the pattern. The entire purpose of the \zs atom is to allow for arbitrarily narrow qualification of a match using the context in which the match appears, but which is not actually part of it. Everything before a \zs is, conceptually, a wholly separate entity, which by its nature is immediately adjacent, but which may be completely unrelated otherwise.
Back to the “actual behavior” example, the given command should have this result:
first line
second line!!!
Possible behavior extension:
Allow for a kind of global command that understands the character-wise position of the match.
e.g. (toy example):
one banana
two apples
:g`\v^\k+\s+\zs\a`normal vgU
one Banana
two Apples
The text was updated successfully, but these errors were encountered:
(n/a issue template “fields” removed)
Actual behaviour
When the pattern given to a
:global
command is given a “starting position” (the zero-width\zs
atom) at some point after a new-line atom (\n
), the position of the action taken is not that of the beginning of the match (at the\zs
), but instead at the beginning of the pattern.e.g. (toy example):
Expected behaviour
The global command should account for the actual starting position of the match, which is not always the same thing as whatever buffer position matches the beginning of the pattern. The entire purpose of the
\zs
atom is to allow for arbitrarily narrow qualification of a match using the context in which the match appears, but which is not actually part of it. Everything before a\zs
is, conceptually, a wholly separate entity, which by its nature is immediately adjacent, but which may be completely unrelated otherwise.Back to the “actual behavior” example, the given command should have this result:
Possible behavior extension:
Allow for a kind of global command that understands the character-wise position of the match.
e.g. (toy example):
The text was updated successfully, but these errors were encountered: