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?
appendwas just what I needed, and the links are helpful.I have found the use of
– Dan Apr 04 '19 at 13:55>to be inconsistent, though. It works from the console, but when I try to pass in a series of commands (a la {{ex $FILENAME << END_EX_COMMANDS}}) it fails. I can do.>and+4>but not>or+.>>.