Open Kwelity opened 4 years ago
Yeah, the reason this happens is that our global implementation first finds all the lines where the pattern matches and marks them, then runs through all the markers and operates on them. I expect it'll break on most commands that manipulate across newlines.
I'm not sure about the exact semantics of Vim's implementation though. I suppose it finds a match, operates on it, moves to the next line and continues. Sort of like n.j0n.j0n.j0...
would behave. I tried a quick and dirty fix but it broke some other tests so I'll have to look at it later. (Or someone else can do it.)
Issue type
Environment
Emacs version: 26.3 Operating System: Arch Linux (5.4.3) Evil version: 1.3.0 Evil installation type: Doom emacs Graphical/Terminal: Both Tested in a
make emacs
session (see CONTRIBUTING.md): NoReproduction steps
exec the global (multi-repeat) cmd:
:g/^/normal J
to exec normal 'J' (join) command to every matchExpected behavior
the behavior I get with vim:
Actual behavior
Further notes
It seems that evil will 'recurcively' execute the :g command, resulting in a single line, whereas vim, will only execute the normal command once.