I am trying to write a command along the lines of the following:
vim -c "XXXXXX" myFile
Instead of the "XXXXX" I want to supply some commands to vim to add some text to an arbitrary point in the file, eitherboth by specifying an exact line number orand, in a different scenario, by searching for a specific line and then insert on the line above.
What I am trying to do is a sort of clever "append" where I can append lines to a code block or function inside a script. Ultimately I am aiming to have a setup script which will go and alter maybe a dozen system files.
Ideally it would only involve one -c flag and ideally it would be readable to anyone that can understand normal mode commands - in my head I was originally thinking something like "ggjjjiInsertingOnLine4:wq" once I can get it into normal mode.