I am trying to script some file changes using ex per this answer.
The issue that I'm running into is that ex seems to assume that every command is preceded by a colon, so while I can do something like:
/^foo()
a
test insertion
.
w!
q
I can't do:
/^foo()
>iB
O
if (bar())
.
w!
q
because it chokes on the second and third lines, as nearly as I can tell because :>iB and :O both return errors in vim.
What am I doing wrong? How can I indent the current braces block and/or insert above the current line within ex?