I would have almost simply started recording a macro, convert the first one using as many idempotent normal mode commands in place of insert mode commands as possible, and simply replayed it. Thanks for the idea.
As a side note, I love how Vim is basically a functional programming language for text editing.
As a side note, I love how Vim is basically a functional programming language for text editing.