I had a large file I was trying to reformat which involved removing the 2nd to nth repeating sets on 2 to 100 lines per duplicate.
The data looked like
element1.element2.element...field.comment
I wanted to remove the repetition in elements after the first instance so of course I went complicated :) and did a macro something like
In a macro Yanked first element on current line to register p and then processed lines yanking the first element into register o
and then doing, still in the macro
:if (@p=!@o)|:.s/paste register p//g|else|:norm! j|endif
Now this worked OK except when it got to a line where @p<>@o
the :norm! j
part stayed in :
mode until I manually escaped once or twice then executed the :norm! j
command.
I solved the problem an easier way but would like to know why it was only on the else portion that it wouldn't leave :ex mode.